|
19 | 19 | * @author Slava Pestov |
20 | 20 | * @version $Id$ |
21 | 21 | */ |
22 | | -public class Token |
23 | | -{ |
24 | | - /** |
25 | | - * Normal text token id. This should be used to mark |
26 | | - * normal text. |
27 | | - */ |
| 22 | +public class Token { |
| 23 | + |
| 24 | + /** Normal text token id. This should be used to mark normal text. */ |
28 | 25 | public static final byte NULL = 0; |
29 | 26 |
|
30 | | - /** |
31 | | - * Comment 1 token id. This can be used to mark a comment. |
32 | | - */ |
| 27 | + /** This can be used to mark a comment. */ |
33 | 28 | public static final byte COMMENT1 = 1; |
34 | 29 |
|
35 | | - /** |
36 | | - * Comment 2 token id. This can be used to mark a comment. |
37 | | - */ |
| 30 | + /** This can be used to mark a comment. */ |
38 | 31 | public static final byte COMMENT2 = 2; |
39 | 32 |
|
40 | | - |
41 | | - /** |
42 | | - * Literal 1 token id. This can be used to mark a string |
43 | | - * literal (eg, C mode uses this to mark "..." literals) |
44 | | - */ |
| 33 | + /** Strings in quotes */ |
45 | 34 | public static final byte LITERAL1 = 3; |
46 | | - |
47 | | - /** |
48 | | - * Literal 2 token id. This can be used to mark an object |
49 | | - * literal (eg, Java mode uses this to mark true, false, etc) |
50 | | - */ |
| 35 | + |
| 36 | + /** Constants (QUARTER_PI, CORNERS, etc.) */ |
51 | 37 | public static final byte LITERAL2 = 4; |
52 | | - |
| 38 | + |
53 | 39 | /** |
54 | 40 | * Label token id. This can be used to mark labels |
55 | 41 | * (eg, C mode uses this to mark ...: sequences) |
56 | 42 | */ |
57 | 43 | public static final byte LABEL = 5; |
58 | 44 |
|
59 | | - /** |
60 | | - * Keyword 1 token id. This can be used to mark a |
61 | | - * keyword. This should be used for general language |
62 | | - * constructs. |
63 | | - */ |
| 45 | + /** Datatypes and keywords (void, int, boolean, etc.) */ |
64 | 46 | public static final byte KEYWORD1 = 6; |
65 | 47 |
|
66 | | - /** |
67 | | - * Keyword 2 token id. This can be used to mark a |
68 | | - * keyword. This should be used for preprocessor |
69 | | - * commands, or variables. |
70 | | - */ |
| 48 | + /** Fields [variables within a class] */ |
71 | 49 | public static final byte KEYWORD2 = 7; |
72 | 50 |
|
73 | | - /** |
74 | | - * Keyword 3 token id. This can be used to mark a |
75 | | - * keyword. This should be used for data types. |
76 | | - */ |
| 51 | + /** Processing variables (width, height, focused, etc.) */ |
77 | 52 | public static final byte KEYWORD3 = 8; |
78 | 53 |
|
| 54 | + /** Functions */ |
79 | 55 | public static final byte FUNCTION1 = 9; |
80 | 56 |
|
| 57 | + /** Methods (functions inside a class) */ |
81 | 58 | public static final byte FUNCTION2 = 10; |
82 | 59 |
|
| 60 | + /** Loop/function-like blocks (for, while, etc.) */ |
| 61 | + public static final byte FUNCTION3 = 12; |
| 62 | + |
83 | 63 | /** |
84 | 64 | * Operator token id. This can be used to mark an |
85 | 65 | * operator. (eg, SQL mode marks +, -, etc with this |
86 | 66 | * token type) |
87 | 67 | */ |
88 | | - public static final byte OPERATOR = 11; |
| 68 | + public static final byte OPERATOR = 13; |
89 | 69 |
|
90 | 70 | /** |
91 | 71 | * Invalid token id. This can be used to mark invalid |
92 | 72 | * or incomplete tokens, so the user can easily spot |
93 | 73 | * syntax errors. |
94 | 74 | */ |
95 | | - public static final byte INVALID = 12; |
| 75 | + public static final byte INVALID = 14; |
96 | 76 |
|
97 | 77 | /** |
98 | 78 | * The total number of defined token ids. |
99 | 79 | */ |
100 | | - public static final byte ID_COUNT = 13; |
| 80 | + public static final byte ID_COUNT = 15; |
101 | 81 |
|
102 | 82 | /** |
103 | 83 | * The first id that can be used for internal state |
|
0 commit comments