KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > core > syntax > deprecated > ELTokenContext


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.core.syntax.deprecated;
21
22 import org.netbeans.editor.BaseTokenID;
23 import org.netbeans.editor.BaseImageTokenID;
24 import org.netbeans.editor.BaseTokenCategory;
25 import org.netbeans.editor.TokenContext;
26 import org.netbeans.editor.TokenContextPath;
27
28 /**
29 * Tokens used in formatting
30 *
31 * @author Petr Jiricka, Petr Pisl
32 * @version 1.00
33 * @deprecated Use {@link ELLexer} instead.
34 */

35
36 public class ELTokenContext extends TokenContext {
37
38     // Token category-ids
39
public static final int KEYWORDS_ID = 1;
40     public static final int OPERATORS_ID = KEYWORDS_ID + 1;
41     public static final int NUMERIC_LITERALS_ID = OPERATORS_ID + 1;
42     public static final int ERRORS_ID = NUMERIC_LITERALS_ID + 1;
43     
44     // Numeric-ids for token-ids
45
public static final int WHITESPACE_ID = ERRORS_ID + 1;
46     public static final int EOL_ID = WHITESPACE_ID + 1;
47     public static final int EL_DELIM_ID = EOL_ID + 1;
48     public static final int STRING_LITERAL_ID = EL_DELIM_ID + 1;
49     public static final int TAG_LIB_PREFIX_ID = STRING_LITERAL_ID + 1;
50     public static final int IDENTIFIER_ID = TAG_LIB_PREFIX_ID + 1;
51     public static final int CHAR_LITERAL_ID = IDENTIFIER_ID + 1;
52     public static final int INT_LITERAL_ID = CHAR_LITERAL_ID + 1;
53     public static final int LONG_LITERAL_ID = INT_LITERAL_ID + 1;
54     public static final int HEX_LITERAL_ID = LONG_LITERAL_ID + 1;
55     public static final int OCTAL_LITERAL_ID = HEX_LITERAL_ID + 1;
56     public static final int FLOAT_LITERAL_ID = OCTAL_LITERAL_ID + 1;
57     public static final int DOUBLE_LITERAL_ID = FLOAT_LITERAL_ID + 1;
58     
59     
60     // Operator numeric-ids
61
public static final int LT_ID = DOUBLE_LITERAL_ID + 1;// <
62
public static final int GT_ID = LT_ID + 1; // >
63
public static final int PLUS_ID = GT_ID + 1; // +
64
public static final int MINUS_ID = PLUS_ID + 1; // -
65
public static final int MUL_ID = MINUS_ID + 1; // *
66
public static final int DIV_ID = MUL_ID + 1; // /
67
public static final int MOD_ID = DIV_ID + 1; // %
68
public static final int DOT_ID = MOD_ID + 1; // .
69
public static final int COMMA_ID = DOT_ID + 1; // ,
70
public static final int QUESTION_ID = COMMA_ID + 1; // ?
71
public static final int NOT_ID = QUESTION_ID + 1; // !
72
public static final int COLON_ID = NOT_ID + 1; // :
73
public static final int SEMICOLON_ID = COLON_ID + 1; // ;
74
public static final int LPAREN_ID = SEMICOLON_ID + 1; // (
75
public static final int RPAREN_ID = LPAREN_ID + 1; // )
76
public static final int LBRACKET_ID = RPAREN_ID + 1; // [
77
public static final int RBRACKET_ID = LBRACKET_ID + 1; // ]
78

79     public static final int AND_AND_ID = RBRACKET_ID + 1; // &&
80
public static final int OR_OR_ID = AND_AND_ID + 1; // ||
81
public static final int LT_EQ_ID = OR_OR_ID + 1; // <=
82
public static final int GT_EQ_ID = LT_EQ_ID + 1; // >=
83
public static final int EQ_EQ_ID = GT_EQ_ID + 1; // ==
84
public static final int NOT_EQ_ID = EQ_EQ_ID + 1; // !=
85

86     // Other keywords numeric-ids
87
public static final int AND_KEYWORD_ID = NOT_EQ_ID + 1;
88     public static final int DIV_KEYWORD_ID = AND_KEYWORD_ID + 1;
89     public static final int EMPTY_KEYWORD_ID = DIV_KEYWORD_ID + 1;
90     public static final int EQ_KEYWORD_ID = EMPTY_KEYWORD_ID + 1;
91     public static final int FALSE_KEYWORD_ID = EQ_KEYWORD_ID + 1;
92     public static final int GE_KEYWORD_ID = FALSE_KEYWORD_ID + 1;
93     public static final int GT_KEYWORD_ID = GE_KEYWORD_ID + 1;
94     public static final int INSTANCEOF_KEYWORD_ID = GT_KEYWORD_ID + 1;
95     public static final int LE_KEYWORD_ID = INSTANCEOF_KEYWORD_ID + 1;
96     public static final int LT_KEYWORD_ID = LE_KEYWORD_ID + 1;
97     public static final int MOD_KEYWORD_ID = LT_KEYWORD_ID + 1;
98     public static final int NE_KEYWORD_ID = MOD_KEYWORD_ID + 1;
99     public static final int NOT_KEYWORD_ID = NE_KEYWORD_ID + 1;
100     public static final int NULL_KEYWORD_ID = NOT_KEYWORD_ID + 1;
101     public static final int OR_KEYWORD_ID = NULL_KEYWORD_ID + 1;
102     public static final int TRUE_KEYWORD_ID = OR_KEYWORD_ID + 1;
103     
104     // Incomplete tokens
105
public static final int INVALID_OCTAL_LITERAL_ID = OR_KEYWORD_ID + 1;
106     public static final int INVALID_CHAR_ID = INVALID_OCTAL_LITERAL_ID + 1;
107     
108     
109     // Token-categories
110
/** All the keywords belong to this category. */
111     public static final BaseTokenCategory KEYWORDS = new BaseTokenCategory("keywords", KEYWORDS_ID); //NOI18M
112

113     /** All the operators belong to this category. */
114     public static final BaseTokenCategory OPERATORS = new BaseTokenCategory("operators", OPERATORS_ID); //NOI18M
115

116     /** All the numeric literals belong to this category. */
117     public static final BaseTokenCategory NUMERIC_LITERALS = new BaseTokenCategory("numeric-literals", NUMERIC_LITERALS_ID); //NOI18M
118

119     /** All the errorneous constructions and incomplete tokens
120      * belong to this category.
121      */

122     public static final BaseTokenCategory ERRORS = new BaseTokenCategory("errors", ERRORS_ID); //NOI18M
123

124     public static final BaseTokenID WHITESPACE = new BaseTokenID("whitespace", WHITESPACE_ID); //NOI18M
125

126     public static final BaseImageTokenID EOL = new BaseImageTokenID("EOL", EOL_ID, "\n"); // NOI18N
127

128 public static final BaseTokenID EL_DELIM = new BaseTokenID("el-delimiter", EL_DELIM_ID); // NOI18N
129

130     public static final BaseTokenID STRING_LITERAL = new BaseTokenID("string", STRING_LITERAL_ID); //NOI18M
131

132     public static final BaseTokenID TAG_LIB_PREFIX = new BaseTokenID("tag-lib-prefix", TAG_LIB_PREFIX_ID);//NOI18M
133

134     public static final BaseTokenID IDENTIFIER = new BaseTokenID("identifier", IDENTIFIER_ID);//NOI18M
135

136     public static final BaseTokenID CHAR_LITERAL = new BaseTokenID("char-literal", CHAR_LITERAL_ID); //NOI18M
137

138     
139     // Operators
140
public static final BaseImageTokenID LT = new BaseImageTokenID("lt", LT_ID, OPERATORS, "<");//NOI18M
141
public static final BaseImageTokenID GT = new BaseImageTokenID("gt", GT_ID, OPERATORS, ">");//NOI18M
142
public static final BaseImageTokenID DOT = new BaseImageTokenID("dot", DOT_ID, OPERATORS, ".");//NOI18M
143
public static final BaseImageTokenID COMMA = new BaseImageTokenID("comma", COMMA_ID, OPERATORS, ",");//NOI18M
144
public static final BaseImageTokenID QUESTION = new BaseImageTokenID("question", QUESTION_ID, OPERATORS, "?");//NOI18M
145
public static final BaseImageTokenID PLUS = new BaseImageTokenID("plus", PLUS_ID, OPERATORS, "+");//NOI18M
146
public static final BaseImageTokenID MINUS = new BaseImageTokenID("minus", MINUS_ID, OPERATORS, "-");//NOI18M
147
public static final BaseImageTokenID MUL = new BaseImageTokenID("mul", MUL_ID, OPERATORS, "*");//NOI18M
148
public static final BaseImageTokenID DIV = new BaseImageTokenID("div", DIV_ID, OPERATORS, "/");//NOI18M
149
public static final BaseImageTokenID MOD = new BaseImageTokenID("mod", MOD_ID, OPERATORS, "%");//NOI18M
150
public static final BaseImageTokenID EQ_EQ = new BaseImageTokenID("eq-eq", EQ_EQ_ID, OPERATORS, "==");//NOI18M
151
public static final BaseImageTokenID LT_EQ = new BaseImageTokenID("le", LT_EQ_ID, OPERATORS, "<=");//NOI18M
152
public static final BaseImageTokenID GT_EQ = new BaseImageTokenID("ge", GT_EQ_ID, OPERATORS, ">=");//NOI18M
153
public static final BaseImageTokenID NOT_EQ = new BaseImageTokenID("not-eq", NOT_EQ_ID, OPERATORS, "!=");//NOI18M
154
public static final BaseImageTokenID AND_AND = new BaseImageTokenID("and-and", AND_AND_ID, OPERATORS, "&&");//NOI18M
155
public static final BaseImageTokenID OR_OR = new BaseImageTokenID("or-or", OR_OR_ID, OPERATORS, "||");//NOI18M
156
public static final BaseImageTokenID COLON = new BaseImageTokenID("colon", COLON_ID, OPERATORS, ":");//NOI18M
157
public static final BaseImageTokenID NOT = new BaseImageTokenID("not", NOT_ID, OPERATORS, "!");//NOI18M
158
public static final BaseImageTokenID LPAREN = new BaseImageTokenID("lparen", LPAREN_ID, OPERATORS, "(");//NOI18M
159
public static final BaseImageTokenID RPAREN = new BaseImageTokenID("rparen", RPAREN_ID, OPERATORS, ")");//NOI18M
160
public static final BaseImageTokenID LBRACKET = new BaseImageTokenID("lbracket", LBRACKET_ID, OPERATORS, "[");//NOI18M
161
public static final BaseImageTokenID RBRACKET = new BaseImageTokenID("rbracket", RBRACKET_ID, OPERATORS, "]");//NOI18M
162

163     // The keywords
164
public static final BaseImageTokenID AND_KEYWORD = new BaseImageTokenID("and", AND_KEYWORD_ID, KEYWORDS);//NOI18M
165
public static final BaseImageTokenID DIV_KEYWORD = new BaseImageTokenID("div", DIV_KEYWORD_ID, KEYWORDS);//NOI18M
166
public static final BaseImageTokenID EMPTY_KEYWORD = new BaseImageTokenID("empty", EMPTY_KEYWORD_ID, KEYWORDS);//NOI18M
167
public static final BaseImageTokenID EQ_KEYWORD = new BaseImageTokenID("eq", EQ_KEYWORD_ID, KEYWORDS);//NOI18M
168
public static final BaseImageTokenID FALSE_KEYWORD = new BaseImageTokenID("false", FALSE_KEYWORD_ID, KEYWORDS);//NOI18M
169
public static final BaseImageTokenID GE_KEYWORD = new BaseImageTokenID("ge", GE_KEYWORD_ID, KEYWORDS);//NOI18M
170
public static final BaseImageTokenID GT_KEYWORD = new BaseImageTokenID("gt", GT_KEYWORD_ID, KEYWORDS);//NOI18M
171
public static final BaseImageTokenID INSTANCEOF_KEYWORD = new BaseImageTokenID("instanceof", INSTANCEOF_KEYWORD_ID, KEYWORDS);//NOI18M
172
public static final BaseImageTokenID LE_KEYWORD = new BaseImageTokenID("le", LE_KEYWORD_ID, KEYWORDS);//NOI18M
173
public static final BaseImageTokenID LT_KEYWORD = new BaseImageTokenID("lt", LT_KEYWORD_ID, KEYWORDS);//NOI18M
174
public static final BaseImageTokenID MOD_KEYWORD = new BaseImageTokenID("mod", MOD_KEYWORD_ID, KEYWORDS);//NOI18M
175
public static final BaseImageTokenID NE_KEYWORD = new BaseImageTokenID("ne", NE_KEYWORD_ID, KEYWORDS);//NOI18M
176
public static final BaseImageTokenID NOT_KEYWORD = new BaseImageTokenID("not", NOT_KEYWORD_ID, KEYWORDS);//NOI18M
177
public static final BaseImageTokenID NULL_KEYWORD = new BaseImageTokenID("null", NULL_KEYWORD_ID, KEYWORDS);//NOI18M
178
public static final BaseImageTokenID OR_KEYWORD = new BaseImageTokenID("or", OR_KEYWORD_ID, KEYWORDS);//NOI18M
179
public static final BaseImageTokenID TRUE_KEYWORD = new BaseImageTokenID("true", TRUE_KEYWORD_ID, KEYWORDS);//NOI18M
180

181     /** Java integer literal e.g. 1234 */
182     public static final BaseTokenID INT_LITERAL
183     = new BaseTokenID("int-literal", INT_LITERAL_ID, NUMERIC_LITERALS);//NOI18M
184

185     /** Java long literal e.g. 12L */
186     public static final BaseTokenID LONG_LITERAL
187     = new BaseTokenID("long-literal", LONG_LITERAL_ID, NUMERIC_LITERALS);//NOI18M
188

189     /** Java hexadecimal literal e.g. 0x5a */
190     public static final BaseTokenID HEX_LITERAL
191     = new BaseTokenID("hex-literal", HEX_LITERAL_ID, NUMERIC_LITERALS);//NOI18M
192

193     /** Java octal literal e.g. 0123 */
194     public static final BaseTokenID OCTAL_LITERAL
195     = new BaseTokenID("octal-literal", OCTAL_LITERAL_ID, NUMERIC_LITERALS);//NOI18M
196

197     /** Java float literal e.g. 1.5e+20f */
198     public static final BaseTokenID FLOAT_LITERAL
199     = new BaseTokenID("float-literal", FLOAT_LITERAL_ID, NUMERIC_LITERALS);//NOI18M
200

201     /** Java double literal e.g. 1.5e+20 */
202     public static final BaseTokenID DOUBLE_LITERAL
203     = new BaseTokenID("double-literal", DOUBLE_LITERAL_ID, NUMERIC_LITERALS);//NOI18M
204

205     // Incomplete and error token-ids
206
public static final BaseTokenID INVALID_OCTAL_LITERAL
207     = new BaseTokenID("invalid-octal-literal", INVALID_OCTAL_LITERAL_ID, ERRORS);//NOI18M
208
public static final BaseTokenID INVALID_CHAR
209     = new BaseTokenID("invalid-char", INVALID_CHAR_ID, ERRORS);//NOI18M
210

211     // Context declaration
212
public static final ELTokenContext context = new ELTokenContext();
213
214     public static final TokenContextPath contextPath = context.getContextPath();
215
216     private ELTokenContext() {
217         super("el-");//NOI18M
218

219         try {
220             addDeclaredTokenIDs();
221         } catch (Exception JavaDoc e) {
222             if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N
223
e.printStackTrace();
224             }
225         }
226
227     }
228
229 }
230
Popular Tags