aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_LSL_tree.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-15 23:47:53 +1000
committerDavid Walter Seikel2012-01-15 23:47:53 +1000
commit737e7f59330532755167a222d4d52bb8cc2d6009 (patch)
treef17e8f1179e2c7f6e5f155287c33ce8e18288b49 /LuaSL/src/LuaSL_LSL_tree.h
parentRe-arrange lemon to run before frex due to dependencies. (diff)
downloadSledjHamr-737e7f59330532755167a222d4d52bb8cc2d6009.zip
SledjHamr-737e7f59330532755167a222d4d52bb8cc2d6009.tar.gz
SledjHamr-737e7f59330532755167a222d4d52bb8cc2d6009.tar.bz2
SledjHamr-737e7f59330532755167a222d4d52bb8cc2d6009.tar.xz
Get multi file parsing working.
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_tree.h')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h37
1 files changed, 11 insertions, 26 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 2ef48ee..b87e7d2 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -3,7 +3,6 @@
3#define __LSL_TREE_H__ 3#define __LSL_TREE_H__
4 4
5#define LUASL_DEBUG 5#define LUASL_DEBUG
6//#define LUASL_FILES
7 6
8 7
9#include <stddef.h> // So we can have NULL defined. 8#include <stddef.h> // So we can have NULL defined.
@@ -264,44 +263,30 @@ struct _LSL_Script
264 LSL_Identifier *variables; 263 LSL_Identifier *variables;
265}; 264};
266 265
266// Define the type for flex and lemon.
267#define YYSTYPE LSL_Leaf
268
267typedef struct 269typedef struct
268{ 270{
269 char *ignorableText; 271 void *scanner; // This should be of type yyscan_t, which is typedef to void * anyway, but that does not get defined until LuaSL_lexer.h, which depends on this struct being defined first.
270 int column;
271 int line;
272 int argc; 272 int argc;
273 char **argv; 273 char **argv;
274 char *fileName; 274 char fileName[PATH_MAX];
275 FILE *file; 275 FILE *file;
276} LuaSL_yyparseExtra; 276 LSL_Leaf *ast;
277 277 char *ignorableText;
278 278 LSL_Leaf *lval;
279// define the type for flex and lemon3 279 int column;
280#define YYSTYPE LSL_Leaf 280 int line;
281} LuaSL_yyparseParam;
281 282
282 283
283#ifndef excludeLexer 284#ifndef excludeLexer
284 #include "LuaSL_lexer.h" 285 #include "LuaSL_lexer.h"
285#endif 286#endif
286 287
287typedef struct
288{
289 yyscan_t scanner;
290 LSL_Leaf *ast;
291 LSL_Leaf *lval;
292} LuaSL_yyparseParam;
293
294// the parameter name (of the reentrant 'yyparse' function)
295// data is a pointer to a 'yyparseParam' structure
296//#define YYPARSE_PARAM data
297
298// the argument for the 'yylex' function
299#define YYLEX_PARAM ((LuaSL_yyparseParam*)data)->scanner
300//#define ParseTOKENTYPE YYSTYPE *
301//#define ParseARG_PDECL , LuaSL_yyparseParam *param
302 288
303void burnLeaf(LSL_Leaf *leaf); 289void burnLeaf(LSL_Leaf *leaf);
304int nextFile(LuaSL_yyparseExtra *extra);
305LSL_Leaf *addExpression(LSL_Leaf *exp); 290LSL_Leaf *addExpression(LSL_Leaf *exp);
306LSL_Leaf *addOperation(LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right); 291LSL_Leaf *addOperation(LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right);
307LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Leaf *rval); 292LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Leaf *rval);