diff options
author | David Walter Seikel | 2012-01-06 16:27:25 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-06 16:27:25 +1000 |
commit | e85ff16e367aaf3b0e68e6a79615496d179f85ca (patch) | |
tree | 91f7df33ee3d0247c7098bc5d0971b95a05a9712 /LuaSL/src/LuaSL_LSL_tree.h | |
parent | Add more debugging stuff. (diff) | |
download | SledjHamr-e85ff16e367aaf3b0e68e6a79615496d179f85ca.zip SledjHamr-e85ff16e367aaf3b0e68e6a79615496d179f85ca.tar.gz SledjHamr-e85ff16e367aaf3b0e68e6a79615496d179f85ca.tar.bz2 SledjHamr-e85ff16e367aaf3b0e68e6a79615496d179f85ca.tar.xz |
Even more debugging stuff, and make it selectable if the parser uses #defines or enums for tokens.
NOTE - enum does not work anyway with btyacc.
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_tree.h')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 7973509..42cf0ac 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -8,7 +8,17 @@ | |||
8 | #define YY_NO_UNISTD_H 1 | 8 | #define YY_NO_UNISTD_H 1 |
9 | #endif // YY_NO_UNISTD_H | 9 | #endif // YY_NO_UNISTD_H |
10 | 10 | ||
11 | //#define LUASL_USE_ENUM | ||
12 | #define LUASL_DEBUG | ||
13 | |||
14 | #ifndef LUASL_USE_ENUM | ||
11 | #include "LuaSL_yaccer.tab.h" | 15 | #include "LuaSL_yaccer.tab.h" |
16 | #endif | ||
17 | |||
18 | #define YYERRCODE 256 | ||
19 | #define YYDEBUG 1 | ||
20 | extern int yydebug; | ||
21 | |||
12 | 22 | ||
13 | // http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. | 23 | // http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. |
14 | 24 | ||
@@ -22,12 +32,12 @@ typedef enum | |||
22 | LSL_CREATION = 16 | 32 | LSL_CREATION = 16 |
23 | } LSL_Flags; | 33 | } LSL_Flags; |
24 | 34 | ||
25 | /* | 35 | #ifdef LUASL_USE_ENUM |
26 | typedef enum // In order of precedence, high to low. | 36 | typedef enum // In order of precedence, high to low. |
27 | // Left to right, unless oterwise stated. | 37 | // Left to right, unless oterwise stated. |
28 | // According to http://wiki.secondlife.com/wiki/Category:LSL_Operators | 38 | // According to http://wiki.secondlife.com/wiki/Category:LSL_Operators |
29 | { | 39 | { |
30 | LSL_COMMA, | 40 | LSL_COMMA = 257, |
31 | LSL_INCREMENT_PRE, // Right to left. | 41 | LSL_INCREMENT_PRE, // Right to left. |
32 | LSL_INCREMENT_POST, // Right to left. | 42 | LSL_INCREMENT_POST, // Right to left. |
33 | LSL_DECREMENT_PRE, // Right to left. | 43 | LSL_DECREMENT_PRE, // Right to left. |
@@ -72,9 +82,9 @@ typedef enum // In order of precedence, high to low. | |||
72 | LSL_BOOL_OR, | 82 | LSL_BOOL_OR, |
73 | LSL_BOOL_AND | 83 | LSL_BOOL_AND |
74 | } LSL_Operation; | 84 | } LSL_Operation; |
75 | */ | 85 | #else |
76 | |||
77 | typedef int LSL_Operation; | 86 | typedef int LSL_Operation; |
87 | #endif | ||
78 | 88 | ||
79 | typedef struct | 89 | typedef struct |
80 | { | 90 | { |
@@ -137,10 +147,11 @@ LSL_Operator LSL_Tokens[] = | |||
137 | }; | 147 | }; |
138 | #endif | 148 | #endif |
139 | 149 | ||
140 | /* | 150 | |
151 | #ifdef LUASL_USE_ENUM | ||
141 | typedef enum | 152 | typedef enum |
142 | { | 153 | { |
143 | LSL_COMMENT, | 154 | LSL_COMMENT = (LSL_BOOL_AND + 1), |
144 | LSL_TYPE, | 155 | LSL_TYPE, |
145 | LSL_NAME, | 156 | LSL_NAME, |
146 | LSL_IDENTIFIER, | 157 | LSL_IDENTIFIER, |
@@ -169,11 +180,10 @@ typedef enum | |||
169 | LSL_STATE, | 180 | LSL_STATE, |
170 | LSL_SCRIPT | 181 | LSL_SCRIPT |
171 | } LSL_Type; | 182 | } LSL_Type; |
172 | */ | 183 | #else |
173 | |||
174 | typedef int LSL_Type; | 184 | typedef int LSL_Type; |
175 | #define LSL_EXPRESSION 1 | 185 | #define LSL_EXPRESSION 1 |
176 | 186 | #endif | |
177 | 187 | ||
178 | #ifdef LSL_Keywords_define | 188 | #ifdef LSL_Keywords_define |
179 | char *LSL_Keywords[] = | 189 | char *LSL_Keywords[] = |