Mon, 21 Jul 2014 17:14:42 +0300
- massive refactoring continues (doesn't compile yet)
119
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
133
dbbdb870c835
- changed all source files to use my correct legal name instead of my calling name
Teemu Piippo <crimsondusk64@gmail.com>
parents:
119
diff
changeset
|
2 | Copyright 2012-2014 Teemu Piippo |
119
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | All rights reserved. |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | Redistribution and use in source and binary forms, with or without |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | modification, are permitted provided that the following conditions |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | are met: |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | 1. Redistributions of source code must retain the above copyright |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | notice, this list of conditions and the following disclaimer. |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | 2. Redistributions in binary form must reproduce the above copyright |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | notice, this list of conditions and the following disclaimer in the |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | documentation and/or other materials provided with the distribution. |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | 3. The name of the author may not be used to endorse or promote products |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | derived from this software without specific prior written permission. |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | */ |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | #ifndef TOKENS_H |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | #define TOKENS_H |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | #include <climits> |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | #include "macros.h" |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | // ======================================================= |
135
8b9132fea327
- massive refactoring continues (doesn't compile yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
36 | named_enum class Token |
119
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | { |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | // Non-word tokens |
134
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
39 | LeftShiftAssign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
40 | RightShiftAssign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
41 | Equals, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
42 | NotEquals, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
43 | AddAssign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
44 | SubAssign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
45 | MultiplyAssign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
46 | DivideAssign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
47 | ModulusAssign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
48 | LeftShift, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
49 | RightShift, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
50 | AtLeast, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
51 | AtMost, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
52 | DoubleAmperstand, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
53 | DoubleBar, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
54 | DoublePlus, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
55 | DoubleMinus, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
56 | SingleQuote, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
57 | DollarSign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
58 | ParenStart, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
59 | ParenEnd, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
60 | BracketStart, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
61 | BracketEnd, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
62 | BraceStart, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
63 | BraceEnd, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
64 | Assign, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
65 | Plus, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
66 | Minus, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
67 | Multiply, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
68 | Divide, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
69 | Modulus, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
70 | Comma, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
71 | Lesser, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
72 | Greater, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
73 | Dot, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
74 | Colon, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
75 | Semicolon, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
76 | Hash, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
77 | ExclamationMark, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
78 | Amperstand, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
79 | Bar, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
80 | Caret, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
81 | QuestionMark, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
82 | Arrow, |
119
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | // -------------- |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | // Named tokens |
134
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
86 | Bool, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
87 | Break, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
88 | Case, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
89 | Continue, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
90 | Const, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
91 | Constexpr, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
92 | Default, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
93 | Do, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
94 | Else, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
95 | Event, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
96 | Eventdef, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
97 | For, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
98 | Funcdef, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
99 | If, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
100 | Int, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
101 | Mainloop, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
102 | Onenter, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
103 | Onexit, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
104 | State, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
105 | Switch, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
106 | Str, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
107 | Using, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
108 | Var, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
109 | Void, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
110 | While, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
111 | True, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
112 | False, |
119
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | // These ones aren't implemented yet but I plan to do so, thus they are |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | // reserved. Also serves as a to-do list of sorts for me. >:F |
134
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
116 | Enum, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
117 | Func, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
118 | Return, |
119
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | // -------------- |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | // Generic tokens |
134
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
122 | Symbol, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
123 | Number, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
124 | String, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
125 | Any, |
eca2fc0acaa2
- massive refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents:
133
diff
changeset
|
126 | |
135
8b9132fea327
- massive refactoring continues (doesn't compile yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
127 | FirstNamedToken = Token::Bool, |
8b9132fea327
- massive refactoring continues (doesn't compile yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
134
diff
changeset
|
128 | LastNamedToken = Token::Return, |
119
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | }; |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | |
bdf8d46c145f
- renamed source files to camelCase
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | #endif |