1 19 package org.netbeans.modules.websvc.editor.completion; 20 21 import java.util.HashMap ; 22 import java.util.Iterator ; 23 import java.util.Map ; 24 import javax.swing.text.BadLocationException ; 25 import org.netbeans.editor.BaseDocument; 26 import org.netbeans.editor.SyntaxSupport; 27 import org.netbeans.editor.TokenItem; 28 import org.netbeans.editor.ext.java.JavaTokenContext; 30 import org.openide.ErrorManager; 31 32 37 public class NNParser { 38 39 private static final int INIT = 0; 41 private static final int NN = 1; private static final int ERROR = 2; 43 private static final int NNNAME = 3; private static final int INNN = 4; private static final int ATTRNAME = 5; private static final int EQ = 6; private static final int ATTRVALUE = 7; 51 public NNParser(BaseDocument bdoc) { 52 SyntaxSupport ssup = bdoc.getSyntaxSupport(); 53 } 57 58 public NN parseAnnotation(int offset) { 59 int nnStart = findAnnotationStart(offset); 60 if(nnStart == -1) { 61 return null; 62 } else { 63 return parseAnnotationOnOffset(nnStart); 64 } 65 } 66 67 68 private NN parseAnnotationOnOffset(int offset) { 69 return null; 196 } 197 198 199 private int findAnnotationStart(int offset) { 200 return -1; 224 } 225 226 230 public class NN { 231 232 private String name; 233 private Map attributes; 234 private int startOffset, endOffset; 235 236 public NN(String name, Map attributes, int startOffset, int endOffset) { 237 this.name = name; 238 this.attributes = attributes; 239 this.startOffset = startOffset; 240 this.endOffset = endOffset; 241 } 242 243 public String getName() { 244 return name; 245 } 246 247 public Map getAttributes() { 248 return attributes; 249 } 250 251 public int getStartOffset() { 252 return startOffset; 253 } 254 255 public int getEndOffset() { 256 return endOffset; 257 } 258 259 public String toString() { 260 String text = "@" + getName() + " [" + getStartOffset() + " - " + getEndOffset() + "]("; 262 Iterator i = getAttributes().keySet().iterator(); 263 while(i.hasNext()) { 264 String key = (String )i.next(); 265 Object value = getAttributes().get(key); 266 text+=key+"="+value.toString()+(i.hasNext() ? "," : ""); 267 } 268 text+=")"; 269 return text; 270 } 271 272 } 273 274 } 275 | Popular Tags |