Source Code Cross Referenced for JavaTokenContext.java in  » Swing-Library » abeille-forms-designer » org » netbeans » editor » ext » java » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » abeille forms designer » org.netbeans.editor.ext.java 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *                 Sun Public License Notice
003:         * 
004:         * The contents of this file are subject to the Sun Public License
005:         * Version 1.0 (the "License"). You may not use this file except in
006:         * compliance with the License. A copy of the License is available at
007:         * http://www.sun.com/
008:         * 
009:         * The Original Code is NetBeans. The Initial Developer of the Original
010:         * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
011:         * Microsystems, Inc. All Rights Reserved.
012:         */
013:
014:        package org.netbeans.editor.ext.java;
015:
016:        import java.util.HashMap;
017:
018:        import org.netbeans.editor.BaseImageTokenID;
019:        import org.netbeans.editor.BaseTokenCategory;
020:        import org.netbeans.editor.BaseTokenID;
021:        import org.netbeans.editor.TokenContext;
022:        import org.netbeans.editor.TokenContextPath;
023:        import org.netbeans.editor.TokenID;
024:
025:        /**
026:         * Java token-context defines token-ids and token-categories used in Java
027:         * language.
028:         * 
029:         * @author Miloslav Metelka
030:         * @version 1.00
031:         */
032:
033:        public class JavaTokenContext extends TokenContext {
034:
035:            // Token category-ids
036:            public static final int KEYWORDS_ID = 1;
037:            public static final int OPERATORS_ID = KEYWORDS_ID + 1;
038:            public static final int NUMERIC_LITERALS_ID = OPERATORS_ID + 1;
039:            public static final int ERRORS_ID = NUMERIC_LITERALS_ID + 1;
040:
041:            // Numeric-ids for token-ids
042:            public static final int WHITESPACE_ID = ERRORS_ID + 1;
043:            public static final int IDENTIFIER_ID = WHITESPACE_ID + 1;
044:            public static final int LINE_COMMENT_ID = IDENTIFIER_ID + 1;
045:            public static final int BLOCK_COMMENT_ID = LINE_COMMENT_ID + 1;
046:            public static final int CHAR_LITERAL_ID = BLOCK_COMMENT_ID + 1;
047:            public static final int STRING_LITERAL_ID = CHAR_LITERAL_ID + 1;
048:            public static final int INT_LITERAL_ID = STRING_LITERAL_ID + 1;
049:            public static final int LONG_LITERAL_ID = INT_LITERAL_ID + 1;
050:            public static final int HEX_LITERAL_ID = LONG_LITERAL_ID + 1;
051:            public static final int OCTAL_LITERAL_ID = HEX_LITERAL_ID + 1;
052:            public static final int FLOAT_LITERAL_ID = OCTAL_LITERAL_ID + 1;
053:            public static final int DOUBLE_LITERAL_ID = FLOAT_LITERAL_ID + 1;
054:
055:            // Operator numeric-ids
056:            public static final int EQ_ID = DOUBLE_LITERAL_ID + 1; // =
057:            public static final int LT_ID = EQ_ID + 1; // <
058:            public static final int GT_ID = LT_ID + 1; // >
059:            public static final int LSHIFT_ID = GT_ID + 1; // <<
060:            public static final int RSSHIFT_ID = LSHIFT_ID + 1; // >>
061:            public static final int RUSHIFT_ID = RSSHIFT_ID + 1; // >>>
062:            public static final int PLUS_ID = RUSHIFT_ID + 1; // +
063:            public static final int MINUS_ID = PLUS_ID + 1; // -
064:            public static final int MUL_ID = MINUS_ID + 1; // *
065:            public static final int DIV_ID = MUL_ID + 1; // /
066:            public static final int AND_ID = DIV_ID + 1; // &
067:            public static final int OR_ID = AND_ID + 1; // |
068:            public static final int XOR_ID = OR_ID + 1; // ^
069:            public static final int MOD_ID = XOR_ID + 1; // %
070:            public static final int NOT_ID = MOD_ID + 1; // !
071:            public static final int NEG_ID = NOT_ID + 1; // ~
072:            public static final int EQ_EQ_ID = NEG_ID + 1; // ==
073:            public static final int LT_EQ_ID = EQ_EQ_ID + 1; // <=
074:            public static final int GT_EQ_ID = LT_EQ_ID + 1; // >=
075:            public static final int LSHIFT_EQ_ID = GT_EQ_ID + 1; // <<=
076:            public static final int RSSHIFT_EQ_ID = LSHIFT_EQ_ID + 1; // >>=
077:            public static final int RUSHIFT_EQ_ID = RSSHIFT_EQ_ID + 1; // >>>=
078:            public static final int PLUS_EQ_ID = RUSHIFT_EQ_ID + 1; // +=
079:            public static final int MINUS_EQ_ID = PLUS_EQ_ID + 1; // -=
080:            public static final int MUL_EQ_ID = MINUS_EQ_ID + 1; // *=
081:            public static final int DIV_EQ_ID = MUL_EQ_ID + 1; // /=
082:            public static final int AND_EQ_ID = DIV_EQ_ID + 1; // &=
083:            public static final int OR_EQ_ID = AND_EQ_ID + 1; // |=
084:            public static final int XOR_EQ_ID = OR_EQ_ID + 1; // ^=
085:            public static final int MOD_EQ_ID = XOR_EQ_ID + 1; // %=
086:            public static final int NOT_EQ_ID = MOD_EQ_ID + 1; // !=
087:            public static final int DOT_ID = NOT_EQ_ID + 1; // .
088:            public static final int COMMA_ID = DOT_ID + 1; // ,
089:            public static final int COLON_ID = COMMA_ID + 1; // :
090:            public static final int SEMICOLON_ID = COLON_ID + 1; // ;
091:            public static final int QUESTION_ID = SEMICOLON_ID + 1; // ?
092:            public static final int LPAREN_ID = QUESTION_ID + 1; // (
093:            public static final int RPAREN_ID = LPAREN_ID + 1; // )
094:            public static final int LBRACKET_ID = RPAREN_ID + 1; // [
095:            public static final int RBRACKET_ID = LBRACKET_ID + 1; // ]
096:            public static final int LBRACE_ID = RBRACKET_ID + 1; // {
097:            public static final int RBRACE_ID = LBRACE_ID + 1; // }
098:            public static final int PLUS_PLUS_ID = RBRACE_ID + 1; // ++
099:            public static final int MINUS_MINUS_ID = PLUS_PLUS_ID + 1; // --
100:            public static final int AND_AND_ID = MINUS_MINUS_ID + 1; // &&
101:            public static final int OR_OR_ID = AND_AND_ID + 1; // ||
102:
103:            // Data type keyword numeric-ids
104:            public static final int BOOLEAN_ID = OR_OR_ID + 1;
105:            public static final int BYTE_ID = BOOLEAN_ID + 1;
106:            public static final int CHAR_ID = BYTE_ID + 1;
107:            public static final int DOUBLE_ID = CHAR_ID + 1;
108:            public static final int FLOAT_ID = DOUBLE_ID + 1;
109:            public static final int INT_ID = FLOAT_ID + 1;
110:            public static final int LONG_ID = INT_ID + 1;
111:            public static final int SHORT_ID = LONG_ID + 1;
112:
113:            // Void type keyword numeric-id
114:            public static final int VOID_ID = SHORT_ID + 1;
115:
116:            // Other keywords numeric-ids
117:            public static final int ABSTRACT_ID = VOID_ID + 1;
118:            public static final int BREAK_ID = ABSTRACT_ID + 1;
119:            public static final int CASE_ID = BREAK_ID + 1;
120:            public static final int CATCH_ID = CASE_ID + 1;
121:            public static final int CLASS_ID = CATCH_ID + 1;
122:            public static final int CONST_ID = CLASS_ID + 1;
123:            public static final int CONTINUE_ID = CONST_ID + 1;
124:            public static final int DEFAULT_ID = CONTINUE_ID + 1;
125:            public static final int DO_ID = DEFAULT_ID + 1;
126:            public static final int ELSE_ID = DO_ID + 1;
127:            public static final int EXTENDS_ID = ELSE_ID + 1;
128:            public static final int FALSE_ID = EXTENDS_ID + 1;
129:            public static final int FINAL_ID = FALSE_ID + 1;
130:            public static final int FINALLY_ID = FINAL_ID + 1;
131:            public static final int FOR_ID = FINALLY_ID + 1;
132:            public static final int GOTO_ID = FOR_ID + 1;
133:            public static final int IF_ID = GOTO_ID + 1;
134:            public static final int IMPLEMENTS_ID = IF_ID + 1;
135:            public static final int IMPORT_ID = IMPLEMENTS_ID + 1;
136:            public static final int INSTANCEOF_ID = IMPORT_ID + 1;
137:            public static final int INTERFACE_ID = INSTANCEOF_ID + 1;
138:            public static final int NATIVE_ID = INTERFACE_ID + 1;
139:            public static final int NEW_ID = NATIVE_ID + 1;
140:            public static final int NULL_ID = NEW_ID + 1;
141:            public static final int PACKAGE_ID = NULL_ID + 1;
142:            public static final int PRIVATE_ID = PACKAGE_ID + 1;
143:            public static final int PROTECTED_ID = PRIVATE_ID + 1;
144:            public static final int PUBLIC_ID = PROTECTED_ID + 1;
145:            public static final int RETURN_ID = PUBLIC_ID + 1;
146:            public static final int STATIC_ID = RETURN_ID + 1;
147:            public static final int STRICTFP_ID = STATIC_ID + 1;
148:            public static final int SUPER_ID = STRICTFP_ID + 1;
149:            public static final int SWITCH_ID = SUPER_ID + 1;
150:            public static final int SYNCHRONIZED_ID = SWITCH_ID + 1;
151:            public static final int THIS_ID = SYNCHRONIZED_ID + 1;
152:            public static final int THROW_ID = THIS_ID + 1;
153:            public static final int THROWS_ID = THROW_ID + 1;
154:            public static final int TRANSIENT_ID = THROWS_ID + 1;
155:            public static final int TRUE_ID = TRANSIENT_ID + 1;
156:            public static final int TRY_ID = TRUE_ID + 1;
157:            public static final int VOLATILE_ID = TRY_ID + 1;
158:            public static final int WHILE_ID = VOLATILE_ID + 1;
159:
160:            // Incomplete tokens
161:            public static final int INCOMPLETE_STRING_LITERAL_ID = WHILE_ID + 1;
162:            public static final int INCOMPLETE_CHAR_LITERAL_ID = INCOMPLETE_STRING_LITERAL_ID + 1;
163:            public static final int INCOMPLETE_HEX_LITERAL_ID = INCOMPLETE_CHAR_LITERAL_ID + 1;
164:            public static final int INVALID_CHAR_ID = INCOMPLETE_HEX_LITERAL_ID + 1;
165:            public static final int INVALID_OPERATOR_ID = INVALID_CHAR_ID + 1;
166:            public static final int INVALID_OCTAL_LITERAL_ID = INVALID_OPERATOR_ID + 1;
167:            public static final int INVALID_COMMENT_END_ID = INVALID_OCTAL_LITERAL_ID + 1;
168:
169:            // Token-categories
170:            /** All the keywords belong to this category. */
171:            public static final BaseTokenCategory KEYWORDS = new BaseTokenCategory(
172:                    "keywords", KEYWORDS_ID);
173:
174:            /** All the operators belong to this category. */
175:            public static final BaseTokenCategory OPERATORS = new BaseTokenCategory(
176:                    "operators", OPERATORS_ID);
177:
178:            /** All the numeric literals belong to this category. */
179:            public static final BaseTokenCategory NUMERIC_LITERALS = new BaseTokenCategory(
180:                    "numeric-literals", NUMERIC_LITERALS_ID);
181:
182:            /**
183:             * All the errorneous constructions and incomplete tokens belong to this
184:             * category.
185:             */
186:            public static final BaseTokenCategory ERRORS = new BaseTokenCategory(
187:                    "errors", ERRORS_ID);
188:
189:            // Token-ids
190:            public static final BaseTokenID WHITESPACE = new BaseTokenID(
191:                    "whitespace", WHITESPACE_ID);
192:
193:            public static final BaseTokenID IDENTIFIER = new BaseTokenID(
194:                    "identifier", IDENTIFIER_ID);
195:
196:            /** Comment with the '//' prefix */
197:            public static final BaseTokenID LINE_COMMENT = new BaseTokenID(
198:                    "line-comment", LINE_COMMENT_ID);
199:
200:            /** Block comment */
201:            public static final BaseTokenID BLOCK_COMMENT = new BaseTokenID(
202:                    "block-comment", BLOCK_COMMENT_ID);
203:
204:            /** Character literal e.g. 'c' */
205:            public static final BaseTokenID CHAR_LITERAL = new BaseTokenID(
206:                    "char-literal", CHAR_LITERAL_ID);
207:
208:            /** Java string literal e.g. "hello" */
209:            public static final BaseTokenID STRING_LITERAL = new BaseTokenID(
210:                    "string-literal", STRING_LITERAL_ID);
211:
212:            /** Java integer literal e.g. 1234 */
213:            public static final BaseTokenID INT_LITERAL = new BaseTokenID(
214:                    "int-literal", INT_LITERAL_ID, NUMERIC_LITERALS);
215:
216:            /** Java long literal e.g. 12L */
217:            public static final BaseTokenID LONG_LITERAL = new BaseTokenID(
218:                    "long-literal", LONG_LITERAL_ID, NUMERIC_LITERALS);
219:
220:            /** Java hexadecimal literal e.g. 0x5a */
221:            public static final BaseTokenID HEX_LITERAL = new BaseTokenID(
222:                    "hex-literal", HEX_LITERAL_ID, NUMERIC_LITERALS);
223:
224:            /** Java octal literal e.g. 0123 */
225:            public static final BaseTokenID OCTAL_LITERAL = new BaseTokenID(
226:                    "octal-literal", OCTAL_LITERAL_ID, NUMERIC_LITERALS);
227:
228:            /** Java float literal e.g. 1.5e+20f */
229:            public static final BaseTokenID FLOAT_LITERAL = new BaseTokenID(
230:                    "float-literal", FLOAT_LITERAL_ID, NUMERIC_LITERALS);
231:
232:            /** Java double literal e.g. 1.5e+20 */
233:            public static final BaseTokenID DOUBLE_LITERAL = new BaseTokenID(
234:                    "double-literal", DOUBLE_LITERAL_ID, NUMERIC_LITERALS);
235:
236:            // Operators
237:            public static final BaseImageTokenID EQ = new BaseImageTokenID(
238:                    "eq", EQ_ID, OPERATORS, "=");
239:
240:            public static final BaseImageTokenID LT = new BaseImageTokenID(
241:                    "lt", LT_ID, OPERATORS, "<");
242:
243:            public static final BaseImageTokenID GT = new BaseImageTokenID(
244:                    "gt", GT_ID, OPERATORS, ">");
245:
246:            public static final BaseImageTokenID LSHIFT = new BaseImageTokenID(
247:                    "lshift", LSHIFT_ID, OPERATORS, "<<");
248:
249:            public static final BaseImageTokenID RSSHIFT = new BaseImageTokenID(
250:                    "rsshift", RSSHIFT_ID, OPERATORS, ">>");
251:
252:            public static final BaseImageTokenID RUSHIFT = new BaseImageTokenID(
253:                    "rushift", RUSHIFT_ID, OPERATORS, ">>>");
254:
255:            public static final BaseImageTokenID PLUS = new BaseImageTokenID(
256:                    "plus", PLUS_ID, OPERATORS, "+");
257:
258:            public static final BaseImageTokenID MINUS = new BaseImageTokenID(
259:                    "minus", MINUS_ID, OPERATORS, "-");
260:
261:            public static final BaseImageTokenID MUL = new BaseImageTokenID(
262:                    "mul", MUL_ID, OPERATORS, "*");
263:
264:            public static final BaseImageTokenID DIV = new BaseImageTokenID(
265:                    "div", DIV_ID, OPERATORS, "/");
266:
267:            public static final BaseImageTokenID AND = new BaseImageTokenID(
268:                    "and", AND_ID, OPERATORS, "&");
269:
270:            public static final BaseImageTokenID OR = new BaseImageTokenID(
271:                    "or", OR_ID, OPERATORS, "|");
272:
273:            public static final BaseImageTokenID XOR = new BaseImageTokenID(
274:                    "xor", XOR_ID, OPERATORS, "^");
275:
276:            public static final BaseImageTokenID MOD = new BaseImageTokenID(
277:                    "mod", MOD_ID, OPERATORS, "%");
278:
279:            public static final BaseImageTokenID NOT = new BaseImageTokenID(
280:                    "not", NOT_ID, OPERATORS, "!");
281:
282:            public static final BaseImageTokenID NEG = new BaseImageTokenID(
283:                    "neg", NEG_ID, OPERATORS, "~");
284:
285:            public static final BaseImageTokenID EQ_EQ = new BaseImageTokenID(
286:                    "eq-eq", EQ_EQ_ID, OPERATORS, "==");
287:
288:            public static final BaseImageTokenID LT_EQ = new BaseImageTokenID(
289:                    "le", LT_EQ_ID, OPERATORS, "<=");
290:
291:            public static final BaseImageTokenID GT_EQ = new BaseImageTokenID(
292:                    "ge", GT_EQ_ID, OPERATORS, ">=");
293:
294:            public static final BaseImageTokenID LSHIFT_EQ = new BaseImageTokenID(
295:                    "lshift-eq", LSHIFT_EQ_ID, OPERATORS, "<<=");
296:
297:            public static final BaseImageTokenID RSSHIFT_EQ = new BaseImageTokenID(
298:                    "rsshift-eq", RSSHIFT_EQ_ID, OPERATORS, ">>=");
299:
300:            public static final BaseImageTokenID RUSHIFT_EQ = new BaseImageTokenID(
301:                    "rushift-eq", RUSHIFT_EQ_ID, OPERATORS, ">>>=");
302:
303:            public static final BaseImageTokenID PLUS_EQ = new BaseImageTokenID(
304:                    "plus-eq", PLUS_EQ_ID, OPERATORS, "+=");
305:
306:            public static final BaseImageTokenID MINUS_EQ = new BaseImageTokenID(
307:                    "minus-eq", MINUS_EQ_ID, OPERATORS, "-=");
308:
309:            public static final BaseImageTokenID MUL_EQ = new BaseImageTokenID(
310:                    "mul-eq", MUL_EQ_ID, OPERATORS, "*=");
311:
312:            public static final BaseImageTokenID DIV_EQ = new BaseImageTokenID(
313:                    "div-eq", DIV_EQ_ID, OPERATORS, "/=");
314:
315:            public static final BaseImageTokenID AND_EQ = new BaseImageTokenID(
316:                    "and-eq", AND_EQ_ID, OPERATORS, "&=");
317:
318:            public static final BaseImageTokenID OR_EQ = new BaseImageTokenID(
319:                    "or-eq", OR_EQ_ID, OPERATORS, "|=");
320:
321:            public static final BaseImageTokenID XOR_EQ = new BaseImageTokenID(
322:                    "xor-eq", XOR_EQ_ID, OPERATORS, "^=");
323:
324:            public static final BaseImageTokenID MOD_EQ = new BaseImageTokenID(
325:                    "mod-eq", MOD_EQ_ID, OPERATORS, "%=");
326:
327:            public static final BaseImageTokenID NOT_EQ = new BaseImageTokenID(
328:                    "not-eq", NOT_EQ_ID, OPERATORS, "!=");
329:
330:            public static final BaseImageTokenID DOT = new BaseImageTokenID(
331:                    "dot", DOT_ID, OPERATORS, ".");
332:
333:            public static final BaseImageTokenID COMMA = new BaseImageTokenID(
334:                    "comma", COMMA_ID, OPERATORS, ",");
335:
336:            public static final BaseImageTokenID COLON = new BaseImageTokenID(
337:                    "colon", COLON_ID, OPERATORS, ":");
338:
339:            public static final BaseImageTokenID SEMICOLON = new BaseImageTokenID(
340:                    "semicolon", SEMICOLON_ID, OPERATORS, ";");
341:
342:            public static final BaseImageTokenID QUESTION = new BaseImageTokenID(
343:                    "question", QUESTION_ID, OPERATORS, "?");
344:
345:            public static final BaseImageTokenID LPAREN = new BaseImageTokenID(
346:                    "lparen", LPAREN_ID, OPERATORS, "(");
347:
348:            public static final BaseImageTokenID RPAREN = new BaseImageTokenID(
349:                    "rparen", RPAREN_ID, OPERATORS, ")");
350:
351:            public static final BaseImageTokenID LBRACKET = new BaseImageTokenID(
352:                    "lbracket", LBRACKET_ID, OPERATORS, "[");
353:
354:            public static final BaseImageTokenID RBRACKET = new BaseImageTokenID(
355:                    "rbracket", RBRACKET_ID, OPERATORS, "]");
356:
357:            public static final BaseImageTokenID LBRACE = new BaseImageTokenID(
358:                    "lbrace", LBRACE_ID, OPERATORS, "{");
359:
360:            public static final BaseImageTokenID RBRACE = new BaseImageTokenID(
361:                    "rbrace", RBRACE_ID, OPERATORS, "}");
362:
363:            public static final BaseImageTokenID PLUS_PLUS = new BaseImageTokenID(
364:                    "plus-plus", PLUS_PLUS_ID, OPERATORS, "++");
365:
366:            public static final BaseImageTokenID MINUS_MINUS = new BaseImageTokenID(
367:                    "minus-minus", MINUS_MINUS_ID, OPERATORS, "--");
368:
369:            public static final BaseImageTokenID AND_AND = new BaseImageTokenID(
370:                    "and-and", AND_AND_ID, OPERATORS, "&&");
371:
372:            public static final BaseImageTokenID OR_OR = new BaseImageTokenID(
373:                    "or-or", OR_OR_ID, OPERATORS, "||");
374:
375:            // Data types
376:            public static final BaseImageTokenID BOOLEAN = new BaseImageTokenID(
377:                    "boolean", BOOLEAN_ID, KEYWORDS);
378:
379:            public static final BaseImageTokenID BYTE = new BaseImageTokenID(
380:                    "byte", BYTE_ID, KEYWORDS);
381:
382:            public static final BaseImageTokenID CHAR = new BaseImageTokenID(
383:                    "char", CHAR_ID, KEYWORDS);
384:
385:            public static final BaseImageTokenID DOUBLE = new BaseImageTokenID(
386:                    "double", DOUBLE_ID, KEYWORDS);
387:
388:            public static final BaseImageTokenID FLOAT = new BaseImageTokenID(
389:                    "float", FLOAT_ID, KEYWORDS);
390:
391:            public static final BaseImageTokenID INT = new BaseImageTokenID(
392:                    "int", INT_ID, KEYWORDS);
393:
394:            public static final BaseImageTokenID LONG = new BaseImageTokenID(
395:                    "long", LONG_ID, KEYWORDS);
396:
397:            public static final BaseImageTokenID SHORT = new BaseImageTokenID(
398:                    "short", SHORT_ID, KEYWORDS);
399:
400:            // Void type
401:            public static final BaseImageTokenID VOID = new BaseImageTokenID(
402:                    "void", VOID_ID, KEYWORDS);
403:
404:            // Rest of the keywords
405:            public static final BaseImageTokenID ABSTRACT = new BaseImageTokenID(
406:                    "abstract", ABSTRACT_ID, KEYWORDS);
407:
408:            public static final BaseImageTokenID BREAK = new BaseImageTokenID(
409:                    "break", BREAK_ID, KEYWORDS);
410:
411:            public static final BaseImageTokenID CASE = new BaseImageTokenID(
412:                    "case", CASE_ID, KEYWORDS);
413:
414:            public static final BaseImageTokenID CATCH = new BaseImageTokenID(
415:                    "catch", CATCH_ID, KEYWORDS);
416:
417:            public static final BaseImageTokenID CLASS = new BaseImageTokenID(
418:                    "class", CLASS_ID, KEYWORDS);
419:
420:            public static final BaseImageTokenID CONST = new BaseImageTokenID(
421:                    "const", CONST_ID, KEYWORDS);
422:
423:            public static final BaseImageTokenID CONTINUE = new BaseImageTokenID(
424:                    "continue", CONTINUE_ID, KEYWORDS);
425:
426:            public static final BaseImageTokenID DEFAULT = new BaseImageTokenID(
427:                    "default", DEFAULT_ID, KEYWORDS);
428:
429:            public static final BaseImageTokenID DO = new BaseImageTokenID(
430:                    "do", DO_ID, KEYWORDS);
431:
432:            public static final BaseImageTokenID ELSE = new BaseImageTokenID(
433:                    "else", ELSE_ID, KEYWORDS);
434:
435:            public static final BaseImageTokenID EXTENDS = new BaseImageTokenID(
436:                    "extends", EXTENDS_ID, KEYWORDS);
437:
438:            public static final BaseImageTokenID FALSE = new BaseImageTokenID(
439:                    "false", FALSE_ID, KEYWORDS);
440:
441:            public static final BaseImageTokenID FINAL = new BaseImageTokenID(
442:                    "final", FINAL_ID, KEYWORDS);
443:
444:            public static final BaseImageTokenID FINALLY = new BaseImageTokenID(
445:                    "finally", FINALLY_ID, KEYWORDS);
446:
447:            public static final BaseImageTokenID FOR = new BaseImageTokenID(
448:                    "for", FOR_ID, KEYWORDS);
449:
450:            public static final BaseImageTokenID GOTO = new BaseImageTokenID(
451:                    "goto", GOTO_ID, KEYWORDS);
452:
453:            public static final BaseImageTokenID IF = new BaseImageTokenID(
454:                    "if", IF_ID, KEYWORDS);
455:
456:            public static final BaseImageTokenID IMPLEMENTS = new BaseImageTokenID(
457:                    "implements", IMPLEMENTS_ID, KEYWORDS);
458:
459:            public static final BaseImageTokenID IMPORT = new BaseImageTokenID(
460:                    "import", IMPORT_ID, KEYWORDS);
461:
462:            public static final BaseImageTokenID INSTANCEOF = new BaseImageTokenID(
463:                    "instanceof", INSTANCEOF_ID, KEYWORDS);
464:
465:            public static final BaseImageTokenID INTERFACE = new BaseImageTokenID(
466:                    "interface", INTERFACE_ID, KEYWORDS);
467:
468:            public static final BaseImageTokenID NATIVE = new BaseImageTokenID(
469:                    "native", NATIVE_ID, KEYWORDS);
470:
471:            public static final BaseImageTokenID NEW = new BaseImageTokenID(
472:                    "new", NEW_ID, KEYWORDS);
473:
474:            public static final BaseImageTokenID NULL = new BaseImageTokenID(
475:                    "null", NULL_ID, KEYWORDS);
476:
477:            public static final BaseImageTokenID PACKAGE = new BaseImageTokenID(
478:                    "package", PACKAGE_ID, KEYWORDS);
479:
480:            public static final BaseImageTokenID PRIVATE = new BaseImageTokenID(
481:                    "private", PRIVATE_ID, KEYWORDS);
482:
483:            public static final BaseImageTokenID PROTECTED = new BaseImageTokenID(
484:                    "protected", PROTECTED_ID, KEYWORDS);
485:
486:            public static final BaseImageTokenID PUBLIC = new BaseImageTokenID(
487:                    "public", PUBLIC_ID, KEYWORDS);
488:
489:            public static final BaseImageTokenID RETURN = new BaseImageTokenID(
490:                    "return", RETURN_ID, KEYWORDS);
491:
492:            public static final BaseImageTokenID STATIC = new BaseImageTokenID(
493:                    "static", STATIC_ID, KEYWORDS);
494:
495:            public static final BaseImageTokenID STRICTFP = new BaseImageTokenID(
496:                    "strictfp", STRICTFP_ID, KEYWORDS);
497:
498:            public static final BaseImageTokenID SUPER = new BaseImageTokenID(
499:                    "super", SUPER_ID, KEYWORDS);
500:
501:            public static final BaseImageTokenID SWITCH = new BaseImageTokenID(
502:                    "switch", SWITCH_ID, KEYWORDS);
503:
504:            public static final BaseImageTokenID SYNCHRONIZED = new BaseImageTokenID(
505:                    "synchronized", SYNCHRONIZED_ID, KEYWORDS);
506:
507:            public static final BaseImageTokenID THIS = new BaseImageTokenID(
508:                    "this", THIS_ID, KEYWORDS);
509:
510:            public static final BaseImageTokenID THROW = new BaseImageTokenID(
511:                    "throw", THROW_ID, KEYWORDS);
512:
513:            public static final BaseImageTokenID THROWS = new BaseImageTokenID(
514:                    "throws", THROWS_ID, KEYWORDS);
515:
516:            public static final BaseImageTokenID TRANSIENT = new BaseImageTokenID(
517:                    "transient", TRANSIENT_ID, KEYWORDS);
518:
519:            public static final BaseImageTokenID TRUE = new BaseImageTokenID(
520:                    "true", TRUE_ID, KEYWORDS);
521:
522:            public static final BaseImageTokenID TRY = new BaseImageTokenID(
523:                    "try", TRY_ID, KEYWORDS);
524:
525:            public static final BaseImageTokenID VOLATILE = new BaseImageTokenID(
526:                    "volatile", VOLATILE_ID, KEYWORDS);
527:
528:            public static final BaseImageTokenID WHILE = new BaseImageTokenID(
529:                    "while", WHILE_ID, KEYWORDS);
530:
531:            // Incomplete and error token-ids
532:            public static final BaseTokenID INCOMPLETE_STRING_LITERAL = new BaseTokenID(
533:                    "incomplete-string-literal", INCOMPLETE_STRING_LITERAL_ID,
534:                    ERRORS);
535:
536:            public static final BaseTokenID INCOMPLETE_CHAR_LITERAL = new BaseTokenID(
537:                    "incomplete-char-literal", INCOMPLETE_CHAR_LITERAL_ID,
538:                    ERRORS);
539:
540:            public static final BaseTokenID INCOMPLETE_HEX_LITERAL = new BaseTokenID(
541:                    "incomplete-hex-literal", INCOMPLETE_HEX_LITERAL_ID, ERRORS);
542:
543:            public static final BaseTokenID INVALID_CHAR = new BaseTokenID(
544:                    "invalid-char", INVALID_CHAR_ID, ERRORS);
545:
546:            public static final BaseTokenID INVALID_OPERATOR = new BaseTokenID(
547:                    "invalid-operator", INVALID_OPERATOR_ID, ERRORS);
548:
549:            public static final BaseTokenID INVALID_OCTAL_LITERAL = new BaseTokenID(
550:                    "invalid-octal-literal", INVALID_OCTAL_LITERAL_ID, ERRORS);
551:
552:            public static final BaseTokenID INVALID_COMMENT_END = new BaseTokenID(
553:                    "invalid-comment-end", INVALID_COMMENT_END_ID, ERRORS);
554:
555:            // Context instance declaration
556:            public static final JavaTokenContext context = new JavaTokenContext();
557:
558:            public static final TokenContextPath contextPath = context
559:                    .getContextPath();
560:
561:            private static final HashMap str2kwd = new HashMap();
562:
563:            static {
564:                BaseImageTokenID[] kwds = new BaseImageTokenID[] { ABSTRACT,
565:                        BREAK, CASE, CATCH, CLASS, CONST, CONTINUE, DEFAULT,
566:                        DO, ELSE, EXTENDS, FALSE, FINAL, FINALLY, FOR, GOTO,
567:                        IF, IMPLEMENTS, IMPORT, INSTANCEOF, INTERFACE, NATIVE,
568:                        NEW, NULL, PACKAGE, PRIVATE, PROTECTED, PUBLIC, RETURN,
569:                        STATIC, SUPER, SWITCH, SYNCHRONIZED, THIS, THROW,
570:                        THROWS, TRANSIENT, TRUE, TRY, VOLATILE, WHILE, BOOLEAN,
571:                        BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT, VOID };
572:
573:                for (int i = kwds.length - 1; i >= 0; i--) {
574:                    str2kwd.put(kwds[i].getImage(), kwds[i]);
575:                }
576:            }
577:
578:            /**
579:             * Checks whether the given token-id is a type-keyword.
580:             * 
581:             * @return true when the keyword is a data type.
582:             */
583:            public static boolean isType(TokenID keywordTokenID) {
584:                int numID = (keywordTokenID != null) ? keywordTokenID
585:                        .getNumericID() : -1;
586:                return (numID >= BOOLEAN_ID && numID < VOID_ID);
587:            }
588:
589:            /** Checks whether the given string is a type-keyword. */
590:            public static boolean isType(String s) {
591:                return isType((TokenID) str2kwd.get(s));
592:            }
593:
594:            /**
595:             * Checks whether the given token-id is a data-type-keyword or void-keyword.
596:             * 
597:             * @return true when the keyword is a data-type-keyword or void-keyword.
598:             */
599:            public static boolean isTypeOrVoid(TokenID keywordTokenID) {
600:                int numID = (keywordTokenID != null) ? keywordTokenID
601:                        .getNumericID() : -1;
602:                return (numID >= BOOLEAN_ID && numID <= VOID_ID);
603:            }
604:
605:            /** Checks whether the given string is a data-type-keyword or void-keyword. */
606:            public static boolean isTypeOrVoid(String s) {
607:                return isTypeOrVoid((TokenID) str2kwd.get(s));
608:            }
609:
610:            /** Get the keyword token-id from string */
611:            public static TokenID getKeyword(String s) {
612:                return (TokenID) str2kwd.get(s);
613:            }
614:
615:            private JavaTokenContext() {
616:                super ("java-");
617:
618:                try {
619:                    addDeclaredTokenIDs();
620:                } catch (Exception e) {
621:                    if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N
622:                        e.printStackTrace();
623:                    }
624:                }
625:
626:            }
627:
628:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.