aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_LSL_tree.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-10 01:43:10 +1000
committerDavid Walter Seikel2012-01-10 01:43:10 +1000
commitff5b1c802a26789ff769521262db79854b24939b (patch)
tree609c9ff857c837bf84d9dd71fe5c1fb7cf3778fd /LuaSL/src/LuaSL_LSL_tree.h
parentHmmm, we have a circular dependencie with the include fiels each of flex and ... (diff)
downloadSledjHamr-ff5b1c802a26789ff769521262db79854b24939b.zip
SledjHamr-ff5b1c802a26789ff769521262db79854b24939b.tar.gz
SledjHamr-ff5b1c802a26789ff769521262db79854b24939b.tar.bz2
SledjHamr-ff5b1c802a26789ff769521262db79854b24939b.tar.xz
Almost got white space and comments working. Still a bug left somewhere, I think it's in operations ordering.
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_tree.h')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h88
1 files changed, 46 insertions, 42 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index adefa07..fe56c29 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -20,7 +20,7 @@ extern int yydebug;
20// http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. 20// http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser.
21 21
22 22
23typedef union _LSL_Leaf LSL_Leaf; 23typedef struct _LSL_Leaf LSL_Leaf;
24typedef struct _LSL_Value LSL_Value; 24typedef struct _LSL_Value LSL_Value;
25typedef struct _LSL_Identifier LSL_Identifier; 25typedef struct _LSL_Identifier LSL_Identifier;
26typedef struct _LSL_Statement LSL_Statement; 26typedef struct _LSL_Statement LSL_Statement;
@@ -65,43 +65,48 @@ typedef struct
65 evaluateToken evaluate; 65 evaluateToken evaluate;
66} LSL_Token; 66} LSL_Token;
67 67
68union _LSL_Leaf 68struct _LSL_Leaf
69{ 69{
70 char *commentValue; 70 union
71 char *spaceValue; 71 {
72 72 char *commentValue;
73 LSL_Type operationValue; 73 char *spaceValue;
74 LSL_AST *expressionValue; 74
75 75 LSL_Type operationValue;
76 float floatValue; 76 LSL_AST *expressionValue;
77 int integerValue; 77
78 char *keyValue; 78 float floatValue;
79 LSL_Leaf *listValue; 79 int integerValue;
80 char *stringValue; 80 char *keyValue;
81 float vectorValue[3]; 81 LSL_Leaf *listValue;
82 float rotationValue[4]; 82 char *stringValue;
83 83 float vectorValue[3];
84 LSL_Identifier *variableValue; 84 float rotationValue[4];
85 85
86 char *labelValue; 86 LSL_Identifier *variableValue;
87 LSL_Statement *doValue; 87
88 LSL_Statement *forValue; 88 char *labelValue;
89 LSL_Statement *elseIfValue; 89 LSL_Statement *doValue;
90 LSL_Statement *elseValue; 90 LSL_Statement *forValue;
91 LSL_Statement *ifValue; 91 LSL_Statement *elseIfValue;
92 char *jumpValue; 92 LSL_Statement *elseValue;
93 LSL_Statement *returnValue; 93 LSL_Statement *ifValue;
94 char *stateChangeValue; 94 char *jumpValue;
95 LSL_Statement *whileValue; 95 LSL_Statement *returnValue;
96 LSL_Statement *statementValue; 96 char *stateChangeValue;
97 97 LSL_Statement *whileValue;
98 LSL_Block *blockValue; 98 LSL_Statement *statementValue;
99 LSL_Identifier *parameterValue; 99
100 LSL_Function *functionValue; 100 LSL_Block *blockValue;
101 LSL_State *stateValue; 101 LSL_Identifier *parameterValue;
102 LSL_Script *scriptValue; 102 LSL_Function *functionValue;
103 103 LSL_State *stateValue;
104 char *unknownValue; 104 LSL_Script *scriptValue;
105
106 char *unknownValue;
107 } value;
108 char *ignorableText;
109 int line, column;
105}; 110};
106 111
107struct _LSL_Value 112struct _LSL_Value
@@ -176,7 +181,7 @@ typedef struct
176} LuaSL_yyparseParam; 181} LuaSL_yyparseParam;
177 182
178// the parameter name (of the reentrant 'yyparse' function) 183// the parameter name (of the reentrant 'yyparse' function)
179// data is a pointer to a 'SParserParam' structure 184// data is a pointer to a 'yyparseParam' structure
180#define YYPARSE_PARAM data 185#define YYPARSE_PARAM data
181 186
182// the argument for the 'yylex' function 187// the argument for the 'yylex' function
@@ -184,12 +189,11 @@ typedef struct
184 189
185 190
186LSL_AST *addExpression(LSL_AST *exp); 191LSL_AST *addExpression(LSL_AST *exp);
187LSL_AST *addInteger(int value); 192LSL_AST *addInteger(LSL_Leaf *lval, int value);
188LSL_AST *addOperation(LSL_Type type, LSL_AST *left, LSL_AST *right); 193LSL_AST *addOperation(LSL_Leaf *lval, LSL_Type type, LSL_AST *left, LSL_AST *right);
189LSL_AST *addParenthesis(LSL_AST *expr); 194LSL_AST *addParenthesis(LSL_Leaf *lval, LSL_AST *expr);
190LSL_Statement *createStatement(LSL_Type type, LSL_AST *root); 195LSL_Statement *createStatement(LSL_Type type, LSL_AST *root);
191LSL_AST *addStatement(LSL_Statement *statement, LSL_AST *root); 196LSL_AST *addStatement(LSL_Statement *statement, LSL_AST *root);
192LSL_AST *addSpace(char *text, LSL_AST *root);
193 197
194int yyerror(const char *msg); 198int yyerror(const char *msg);
195int yyparse(void *param); 199int yyparse(void *param);