|
1 /* |
|
2 Copyright (c) 2013-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 are met: |
|
7 |
|
8 * Redistributions of source code must retain the above copyright |
|
9 notice, this list of conditions and the following disclaimer. |
|
10 |
|
11 * 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 |
|
15 * Neither the name of the <organization> nor the |
|
16 names of its contributors may be used to endorse or promote products |
|
17 derived from this software without specific prior written permission. |
|
18 |
|
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
22 DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY |
|
23 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
26 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 */ |
|
30 |
|
31 #ifndef TOKENS_H |
|
32 #define TOKENS_H |
|
33 |
|
34 // ======================================================= |
|
35 enum e_token |
|
36 { |
|
37 // Non-word tokens |
|
38 tk_equals, // ----- 0 |
|
39 tk_brackets, // - 1 |
|
40 tk_add_assign, // - 2 |
|
41 tk_sub_assign, // - 3 |
|
42 tk_multiply_assign, // - 4 |
|
43 tk_divide_assign, // ----- 5 |
|
44 tk_modulus_assign, // - 6 |
|
45 tk_single_quote, // - 7 |
|
46 tk_dollar_sign, // - 8 |
|
47 tk_paren_start, // - 9 |
|
48 tk_paren_end, // ----- 10 |
|
49 tk_bracket_start, // - 11 |
|
50 tk_bracket_end, // - 12 |
|
51 tk_brace_start, // - 13 |
|
52 tk_brace_end, // - 14 |
|
53 tk_assign, // ----- 15 |
|
54 tk_plus, // - 16 |
|
55 tk_minus, // - 17 |
|
56 tk_multiply, // - 18 |
|
57 tk_divide, // - 19 |
|
58 tk_modulus, // ----- 20 |
|
59 tk_comma, // - 21 |
|
60 tk_lesser, // - 22 |
|
61 tk_greater, // - 23 |
|
62 tk_dot, // - 24 |
|
63 tk_colon, // ----- 25 |
|
64 tk_semicolon, // - 26 |
|
65 tk_hash, // - 27 |
|
66 tk_exclamation_mark, // - 28 |
|
67 tk_arrow, // - 29 |
|
68 |
|
69 // -------------- |
|
70 // Named tokens |
|
71 tk_bool, // ----- 30 |
|
72 tk_break, // - 31 |
|
73 tk_case, // - 32 |
|
74 tk_continue, // - 33 |
|
75 tk_const, // - 34 |
|
76 tk_default, // ----- 35 |
|
77 tk_do, // - 36 |
|
78 tk_else, // - 37 |
|
79 tk_event, // - 38 |
|
80 tk_for, // - 39 |
|
81 tk_goto, // ----- 40 |
|
82 tk_if, // - 41 |
|
83 tk_int, // - 42 |
|
84 tk_mainloop, // - 43 |
|
85 tk_onenter, // - 44 |
|
86 tk_onexit, // ----- 45 |
|
87 tk_state, // - 46 |
|
88 tk_switch, // - 47 |
|
89 tk_str, // - 48 |
|
90 tk_void, // - 49 |
|
91 tk_while, // ----- 50 |
|
92 |
|
93 // These ones aren't implemented yet but I plan to do so, thus they are |
|
94 // reserved. Also serves as a to-do list of sorts for me. >:F |
|
95 tk_enum, // - 51 |
|
96 tk_func, // - 52 |
|
97 tk_return, // - 53 |
|
98 |
|
99 // -------------- |
|
100 // Generic tokens |
|
101 tk_symbol, // - 54 |
|
102 tk_number, // ----- 55 |
|
103 tk_string, // - 56 |
|
104 |
|
105 last_named_token = (int) tk_symbol - 1, |
|
106 tk_any = INT_MAX |
|
107 }; |
|
108 |
|
109 #endif |