diff options
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_tree.h')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 29 |
1 files changed, 11 insertions, 18 deletions
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; | |||
28 | typedef struct _LSL_Function LSL_Function; | 28 | typedef struct _LSL_Function LSL_Function; |
29 | typedef struct _LSL_State LSL_State; | 29 | typedef struct _LSL_State LSL_State; |
30 | typedef struct _LSL_Script LSL_Script; | 30 | typedef struct _LSL_Script LSL_Script; |
31 | typedef struct _LSL_AST LSL_AST; | ||
32 | 31 | ||
33 | extern LSL_Token **tokens; | 32 | extern LSL_Token **tokens; |
34 | extern int lowestToken; | 33 | extern int lowestToken; |
@@ -70,13 +69,15 @@ struct _LSL_Token | |||
70 | 69 | ||
71 | struct _LSL_Leaf | 70 | struct _LSL_Leaf |
72 | { | 71 | { |
72 | LSL_Leaf *left; | ||
73 | LSL_Leaf *right; | ||
73 | union | 74 | union |
74 | { | 75 | { |
75 | char *commentValue; | 76 | char *commentValue; |
76 | char *spaceValue; | 77 | char *spaceValue; |
77 | 78 | ||
78 | LSL_Type operationValue; | 79 | LSL_Type operationValue; |
79 | LSL_AST *expressionValue; | 80 | LSL_Leaf *expressionValue; |
80 | 81 | ||
81 | float floatValue; | 82 | float floatValue; |
82 | int integerValue; | 83 | int integerValue; |
@@ -110,7 +111,6 @@ struct _LSL_Leaf | |||
110 | } value; | 111 | } value; |
111 | char *ignorableText; | 112 | char *ignorableText; |
112 | LSL_Token *token; | 113 | LSL_Token *token; |
113 | LSL_Type type; | ||
114 | int line, column; | 114 | int line, column; |
115 | }; | 115 | }; |
116 | 116 | ||
@@ -122,7 +122,7 @@ struct _LSL_Identifier // For variables and function parameters. | |||
122 | 122 | ||
123 | struct _LSL_Statement | 123 | struct _LSL_Statement |
124 | { | 124 | { |
125 | LSL_AST *expressions; /// For things like a for statement, might hold three expressions. | 125 | LSL_Leaf *expressions; /// For things like a for statement, might hold three expressions. |
126 | }; | 126 | }; |
127 | 127 | ||
128 | struct _LSL_Block | 128 | struct _LSL_Block |
@@ -152,13 +152,6 @@ struct _LSL_Script | |||
152 | LSL_Identifier *variables; | 152 | LSL_Identifier *variables; |
153 | }; | 153 | }; |
154 | 154 | ||
155 | struct _LSL_AST | ||
156 | { | ||
157 | LSL_AST *left; | ||
158 | LSL_AST *right; | ||
159 | LSL_Leaf content; | ||
160 | }; | ||
161 | |||
162 | 155 | ||
163 | // define the type for flex and bison | 156 | // define the type for flex and bison |
164 | #define YYSTYPE LSL_Leaf | 157 | #define YYSTYPE LSL_Leaf |
@@ -172,7 +165,7 @@ struct _LSL_AST | |||
172 | typedef struct | 165 | typedef struct |
173 | { | 166 | { |
174 | yyscan_t scanner; | 167 | yyscan_t scanner; |
175 | LSL_AST *ast; | 168 | LSL_Leaf *ast; |
176 | } LuaSL_yyparseParam; | 169 | } LuaSL_yyparseParam; |
177 | 170 | ||
178 | // the parameter name (of the reentrant 'yyparse' function) | 171 | // the parameter name (of the reentrant 'yyparse' function) |
@@ -183,12 +176,12 @@ typedef struct | |||
183 | #define YYLEX_PARAM ((LuaSL_yyparseParam*)data)->scanner | 176 | #define YYLEX_PARAM ((LuaSL_yyparseParam*)data)->scanner |
184 | 177 | ||
185 | 178 | ||
186 | LSL_AST *addExpression(LSL_AST *exp); | 179 | LSL_Leaf *addExpression(LSL_Leaf *exp); |
187 | LSL_AST *addInteger(LSL_Leaf *lval, int value); | 180 | LSL_Leaf *addInteger(LSL_Leaf *lval, int value); |
188 | LSL_AST *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_AST *left, LSL_AST *right); | 181 | LSL_Leaf *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *left, LSL_Leaf *right); |
189 | LSL_AST *addParenthesis(LSL_Leaf *lval, LSL_AST *expr); | 182 | LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr); |
190 | LSL_Statement *createStatement(LSL_Type type, LSL_AST *root); | 183 | LSL_Statement *createStatement(LSL_Type type, LSL_Leaf *root); |
191 | LSL_AST *addStatement(LSL_Statement *statement, LSL_AST *root); | 184 | LSL_Leaf *addStatement(LSL_Statement *statement, LSL_Leaf *root); |
192 | 185 | ||
193 | int yyerror(const char *msg); | 186 | int yyerror(const char *msg); |
194 | int yyparse(void *param); | 187 | int yyparse(void *param); |