1 19 package org.netbeans.api.gsf; 20 21 import org.netbeans.api.lexer.TokenId; 22 23 24 28 public class GsfTokenId implements TokenId { 29 public static final GsfTokenId ERROR = new GsfTokenId("GSF_ERROR", null, "error"); 30 public static final GsfTokenId IDENTIFIER = new GsfTokenId("GSF_IDENTIFIER", null, "identifier"); 31 public static final GsfTokenId CLASS_VAR = new GsfTokenId("GSF_CLASS", null, "staticfield"); 32 public static final GsfTokenId INSTANCE_VAR = new GsfTokenId("GSF_INSTANCE", null, "field"); 33 public static final GsfTokenId GLOBAL_VAR = new GsfTokenId("GSF_GLOBAL", null, "static"); 34 public static final GsfTokenId CONSTANT = new GsfTokenId("GSF_CONSTANT", null, "constant"); 35 public static final GsfTokenId DOCUMENTATION = new GsfTokenId("GSF_DOCUMENTATION", null, "comment"); 36 public static final GsfTokenId INT_LITERAL = new GsfTokenId("GSF_INT_LITERAL", null, "number"); 38 public static final GsfTokenId REGEXP_LITERAL = new GsfTokenId("GSF_REGEXP_LITERAL", null, "regexp"); 39 public static final GsfTokenId LONG_LITERAL = new GsfTokenId("GSF_LONG_LITERAL", null, "number"); 40 public static final GsfTokenId FLOAT_LITERAL = new GsfTokenId("GSF_FLOAT_LITERAL", null, "number"); 41 public static final GsfTokenId DOUBLE_LITERAL = new GsfTokenId("GSF_DOUBLE_LITERAL", null, "number"); 42 public static final GsfTokenId CHAR_LITERAL = new GsfTokenId("GSF_CHAR_LITERAL", null, "character"); 43 public static final GsfTokenId STRING_LITERAL = new GsfTokenId("GSF_STRING_LITERAL", null, "string"); 44 public static final GsfTokenId WHITESPACE = new GsfTokenId("GSF_WHITESPACE", null, "whitespace"); 45 public static final GsfTokenId LINE_COMMENT = new GsfTokenId("GSF_LINE_COMMENT", null, "comment"); 46 public static final GsfTokenId BLOCK_COMMENT = new GsfTokenId("GSF_BLOCK_COMMENT", null, "comment"); 47 public static final GsfTokenId TODO = new GsfTokenId("GSF_TODO", null, "todo"); 48 public static final GsfTokenId TYPE_SYMBOL = new GsfTokenId("GSF_TYPESYMBOL", null, "typesymbol"); 49 50 public static final GsfTokenId LPAREN = new GsfTokenId("GSF_LPAREN", "(", "separator"); 51 public static final GsfTokenId RPAREN = new GsfTokenId("GSF_RPAREN", ")", "separator"); 52 public static final GsfTokenId LBRACE = new GsfTokenId("GSF_LBRACE", "{", "separator"); 53 public static final GsfTokenId RBRACE = new GsfTokenId("GSF_RBRACE", "}", "separator"); 54 public static final GsfTokenId LBRACKET = new GsfTokenId("GSF_LBRACKET", "[", "separator"); 55 public static final GsfTokenId RBRACKET = new GsfTokenId("GSF_RBRACKET", "]", "separator"); 56 public static final GsfTokenId STRING_BEGIN = new GsfTokenId("GSF_STRING_BEGIN", null, "string"); 57 public static final GsfTokenId STRING_END = new GsfTokenId("GSF_STRING_END", null, "string"); 58 public static final GsfTokenId REGEXP_BEGIN = new GsfTokenId("GSF_REGEXP_BEGIN", null, "regexp"); public static final GsfTokenId REGEXP_END = new GsfTokenId("GSF_REGEXP_END", null, "regexp"); 60 61 public static final GsfTokenId CHAR_LITERAL_INCOMPLETE = new GsfTokenId("GSF_CHAR_LITERAL_INCOMPLETE", null, "character"); 63 public static final GsfTokenId STRING_LITERAL_INCOMPLETE = new GsfTokenId("GSF_STRING_LITERAL_INCOMPLETE", null, "string"); 64 public static final GsfTokenId BLOCK_COMMENT_INCOMPLETE = new GsfTokenId("GSF_BLOCK_COMMENT_INCOMPLETE", null, "comment"); 65 public static final GsfTokenId JAVADOC_COMMENT_INCOMPLETE = new GsfTokenId("GSF_JAVADOC_COMMENT_INCOMPLETE", null, "comment"); 66 public static final GsfTokenId INVALID_COMMENT_END = new GsfTokenId("GSF_INVALID_COMMENT_END", "*/", "error"); 67 public static final GsfTokenId FLOAT_LITERAL_INVALID = new GsfTokenId("GSF_FLOAT_LITERAL_INVALID", null, "number"); 68 69 public static final GsfTokenId ANY_KEYWORD = new GsfTokenId("GSF_ANY_KEYWORD", null, "keyword"); 74 public static final GsfTokenId ANY_OPERATOR = new GsfTokenId("GSF_ANY_OPERATOR", null, "operator"); 75 76 private final String name; 77 private final String primaryCategory; 78 private final String fixedText; 79 private final int ordinal; 80 protected static int nextOrdinal; 81 82 public GsfTokenId(String name, String fixedText, String primaryCategory) { 83 this.name = name; 84 this.primaryCategory = primaryCategory; 85 this.fixedText = fixedText; 86 synchronized (GsfTokenId.class) { 87 this.ordinal = nextOrdinal++; 88 } 89 } 90 91 public String primaryCategory() { 92 return primaryCategory; 93 } 94 95 public String fixedText() { 96 return fixedText; 97 } 98 99 public String name() { 100 return name; 101 } 102 103 public int ordinal() { 104 return ordinal; 105 } 106 107 public String toString() { 108 return getClass().getName() + ":" + name + ":" + ordinal; 109 } 110 } 111 | Popular Tags |