From eb8dda3811a849ef633faa225cf1427bf93a4494 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 10 Jan 2012 03:30:17 +1000 Subject: Get rid of the LSL_AST structure, it's all in LSL_Leaf now. --- LuaSL/src/LuaSL_LSL_tree.h | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'LuaSL/src/LuaSL_LSL_tree.h') diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 5d39b3b..4676171 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -28,7 +28,6 @@ typedef struct _LSL_Block LSL_Block; typedef struct _LSL_Function LSL_Function; typedef struct _LSL_State LSL_State; typedef struct _LSL_Script LSL_Script; -typedef struct _LSL_AST LSL_AST; extern LSL_Token **tokens; extern int lowestToken; @@ -70,13 +69,15 @@ struct _LSL_Token struct _LSL_Leaf { + LSL_Leaf *left; + LSL_Leaf *right; union { char *commentValue; char *spaceValue; LSL_Type operationValue; - LSL_AST *expressionValue; + LSL_Leaf *expressionValue; float floatValue; int integerValue; @@ -110,7 +111,6 @@ struct _LSL_Leaf } value; char *ignorableText; LSL_Token *token; - LSL_Type type; int line, column; }; @@ -122,7 +122,7 @@ struct _LSL_Identifier // For variables and function parameters. struct _LSL_Statement { - LSL_AST *expressions; /// For things like a for statement, might hold three expressions. + LSL_Leaf *expressions; /// For things like a for statement, might hold three expressions. }; struct _LSL_Block @@ -152,13 +152,6 @@ struct _LSL_Script LSL_Identifier *variables; }; -struct _LSL_AST -{ - LSL_AST *left; - LSL_AST *right; - LSL_Leaf content; -}; - // define the type for flex and bison #define YYSTYPE LSL_Leaf @@ -172,7 +165,7 @@ struct _LSL_AST typedef struct { yyscan_t scanner; - LSL_AST *ast; + LSL_Leaf *ast; } LuaSL_yyparseParam; // the parameter name (of the reentrant 'yyparse' function) @@ -183,12 +176,12 @@ typedef struct #define YYLEX_PARAM ((LuaSL_yyparseParam*)data)->scanner -LSL_AST *addExpression(LSL_AST *exp); -LSL_AST *addInteger(LSL_Leaf *lval, int value); -LSL_AST *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_AST *left, LSL_AST *right); -LSL_AST *addParenthesis(LSL_Leaf *lval, LSL_AST *expr); -LSL_Statement *createStatement(LSL_Type type, LSL_AST *root); -LSL_AST *addStatement(LSL_Statement *statement, LSL_AST *root); +LSL_Leaf *addExpression(LSL_Leaf *exp); +LSL_Leaf *addInteger(LSL_Leaf *lval, int value); +LSL_Leaf *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *left, LSL_Leaf *right); +LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr); +LSL_Statement *createStatement(LSL_Type type, LSL_Leaf *root); +LSL_Leaf *addStatement(LSL_Statement *statement, LSL_Leaf *root); int yyerror(const char *msg); int yyparse(void *param); -- cgit v1.1