aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_LSL_tree.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-10 03:30:17 +1000
committerDavid Walter Seikel2012-01-10 03:30:17 +1000
commiteb8dda3811a849ef633faa225cf1427bf93a4494 (patch)
treee360394cc64c99ca94238c2442bd0cf7b29617d1 /LuaSL/src/LuaSL_LSL_tree.h
parentMove more things into the LSL_Leaf structure, and some clean up related to that. (diff)
downloadSledjHamr-eb8dda3811a849ef633faa225cf1427bf93a4494.zip
SledjHamr-eb8dda3811a849ef633faa225cf1427bf93a4494.tar.gz
SledjHamr-eb8dda3811a849ef633faa225cf1427bf93a4494.tar.bz2
SledjHamr-eb8dda3811a849ef633faa225cf1427bf93a4494.tar.xz
Get rid of the LSL_AST structure, it's all in LSL_Leaf now.
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h29
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;
28typedef struct _LSL_Function LSL_Function; 28typedef struct _LSL_Function LSL_Function;
29typedef struct _LSL_State LSL_State; 29typedef struct _LSL_State LSL_State;
30typedef struct _LSL_Script LSL_Script; 30typedef struct _LSL_Script LSL_Script;
31typedef struct _LSL_AST LSL_AST;
32 31
33extern LSL_Token **tokens; 32extern LSL_Token **tokens;
34extern int lowestToken; 33extern int lowestToken;
@@ -70,13 +69,15 @@ struct _LSL_Token
70 69
71struct _LSL_Leaf 70struct _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
123struct _LSL_Statement 123struct _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
128struct _LSL_Block 128struct _LSL_Block
@@ -152,13 +152,6 @@ struct _LSL_Script
152 LSL_Identifier *variables; 152 LSL_Identifier *variables;
153}; 153};
154 154
155struct _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
172typedef struct 165typedef 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
186LSL_AST *addExpression(LSL_AST *exp); 179LSL_Leaf *addExpression(LSL_Leaf *exp);
187LSL_AST *addInteger(LSL_Leaf *lval, int value); 180LSL_Leaf *addInteger(LSL_Leaf *lval, int value);
188LSL_AST *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_AST *left, LSL_AST *right); 181LSL_Leaf *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *left, LSL_Leaf *right);
189LSL_AST *addParenthesis(LSL_Leaf *lval, LSL_AST *expr); 182LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr);
190LSL_Statement *createStatement(LSL_Type type, LSL_AST *root); 183LSL_Statement *createStatement(LSL_Type type, LSL_Leaf *root);
191LSL_AST *addStatement(LSL_Statement *statement, LSL_AST *root); 184LSL_Leaf *addStatement(LSL_Statement *statement, LSL_Leaf *root);
192 185
193int yyerror(const char *msg); 186int yyerror(const char *msg);
194int yyparse(void *param); 187int yyparse(void *param);