src/tokens.h

changeset 88
5def6ff8b466
parent 87
8f65914e7046
child 89
029a330a9bef
equal deleted inserted replaced
87:8f65914e7046 88:5def6ff8b466
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 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_eventdef, // - 39
81 tk_for, // ----- 40
82 tk_funcdef, // - 41
83 tk_goto, // - 42
84 tk_if, // - 43
85 tk_int, // - 44
86 tk_mainloop, // ----- 45
87 tk_onenter, // - 46
88 tk_onexit, // - 47
89 tk_state, // - 48
90 tk_switch, // - 49
91 tk_str, // ----- 50
92 tk_void, // - 51
93 tk_while, // - 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 tk_enum, // - 53
98 tk_func, // - 54
99 tk_return, // ----- 55
100
101 // --------------
102 // Generic tokens
103 tk_symbol, // - 56
104 tk_number, // - 57
105 tk_string, // - 58
106
107 tk_first_named_token = tk_bool,
108 tk_last_named_token = (int) tk_symbol - 1,
109 tk_any = INT_MAX
110 };
111
112 #endif

mercurial