|
1 /* |
|
2 Copyright 2012-2014 Santeri Piippo |
|
3 All rights reserved. |
|
4 |
|
5 Redistribution and use in source and binary forms, with or without |
|
6 modification, are permitted provided that the following conditions |
|
7 are met: |
|
8 |
|
9 1. Redistributions of source code must retain the above copyright |
|
10 notice, this list of conditions and the following disclaimer. |
|
11 2. Redistributions in binary form must reproduce the above copyright |
|
12 notice, this list of conditions and the following disclaimer in the |
|
13 documentation and/or other materials provided with the distribution. |
|
14 3. The name of the author may not be used to endorse or promote products |
|
15 derived from this software without specific prior written permission. |
|
16 |
|
17 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
20 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
21 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
|
22 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
27 */ |
|
28 |
|
29 #ifndef TOKENS_H |
|
30 #define TOKENS_H |
|
31 |
|
32 #include <climits> |
|
33 |
|
34 // ======================================================= |
|
35 enum EToken |
|
36 { |
|
37 // Non-word tokens |
|
38 tkEquals, // ----- 0 |
|
39 tkBrackets, // - 1 |
|
40 tkAddAssign, // - 2 |
|
41 tkSubAssign, // - 3 |
|
42 tkMultiplyAssign, // - 4 |
|
43 tkDivideAssign, // ----- 5 |
|
44 tkModulusAssign, // - 6 |
|
45 tkSingleQuote, // - 7 |
|
46 tkDollarSign, // - 8 |
|
47 tkParenStart, // - 9 |
|
48 tkParenEnd, // ----- 10 |
|
49 tkBracketStart, // - 11 |
|
50 tkBracketEnd, // - 12 |
|
51 tkBraceStart, // - 13 |
|
52 tkBraceEnd, // - 14 |
|
53 tkAssign, // ----- 15 |
|
54 tkPlus, // - 16 |
|
55 tkMinus, // - 17 |
|
56 tkMultiply, // - 18 |
|
57 tkDivide, // - 19 |
|
58 tkModulus, // ----- 20 |
|
59 tkComma, // - 21 |
|
60 tkLesser, // - 22 |
|
61 tkGreater, // - 23 |
|
62 tkDot, // - 24 |
|
63 tkColon, // ----- 25 |
|
64 tkSemicolon, // - 26 |
|
65 tkHash, // - 27 |
|
66 tkExclamationMark, // - 28 |
|
67 tkArrow, // - 29 |
|
68 |
|
69 // -------------- |
|
70 // Named tokens |
|
71 tkBool, // ----- 30 |
|
72 tkBreak, // - 31 |
|
73 tkCase, // - 32 |
|
74 tkContinue, // - 33 |
|
75 tkConst, // - 34 |
|
76 tkDefault, // ----- 35 |
|
77 tkDo, // - 36 |
|
78 tkElse, // - 37 |
|
79 tkEvent, // - 38 |
|
80 tkEventdef, // - 39 |
|
81 tkFor, // ----- 40 |
|
82 tkFuncdef, // - 41 |
|
83 tkGoto, // - 42 |
|
84 tkIf, // - 43 |
|
85 tkInt, // - 44 |
|
86 tkMainloop, // ----- 45 |
|
87 tkOnenter, // - 46 |
|
88 tkOnexit, // - 47 |
|
89 tkState, // - 48 |
|
90 tkSwitch, // - 49 |
|
91 tkStr, // ----- 50 |
|
92 tkVoid, // - 51 |
|
93 tkWhile, // - 52 |
|
94 |
|
95 // These ones aren't implemented yet but I plan to do so, thus they are |
|
96 // reserved. Also serves as a to-do list of sorts for me. >:F |
|
97 tkEnum, // - 53 |
|
98 tkFunc, // - 54 |
|
99 tkReturn, // ----- 55 |
|
100 |
|
101 // -------------- |
|
102 // Generic tokens |
|
103 tkSymbol, // - 56 |
|
104 tkNumber, // - 57 |
|
105 tkString, // - 58 |
|
106 |
|
107 tkFirstNamedToken = tkBool, |
|
108 tkLastNamedToken = (int) tkSymbol - 1, |
|
109 tkAny = INT_MAX |
|
110 }; |
|
111 |
|
112 #endif |