aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_LSL_tree.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-10 02:47:49 +1000
committerDavid Walter Seikel2012-01-10 02:47:49 +1000
commit21ae463bfa5ff2398734605fb04fb8d585ee879f (patch)
treea04724543034085aaa0c2ae4f561313e2d2ca436 /LuaSL/src/LuaSL_LSL_tree.h
parentAlmost got white space and comments working. Still a bug left somewhere, I t... (diff)
downloadSledjHamr-21ae463bfa5ff2398734605fb04fb8d585ee879f.zip
SledjHamr-21ae463bfa5ff2398734605fb04fb8d585ee879f.tar.gz
SledjHamr-21ae463bfa5ff2398734605fb04fb8d585ee879f.tar.bz2
SledjHamr-21ae463bfa5ff2398734605fb04fb8d585ee879f.tar.xz
Move more things into the LSL_Leaf structure, and some clean up related to that.
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_tree.h')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h43
1 files changed, 19 insertions, 24 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index fe56c29..5d39b3b 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -20,8 +20,8 @@ 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 struct _LSL_Token LSL_Token;
23typedef struct _LSL_Leaf LSL_Leaf; 24typedef struct _LSL_Leaf LSL_Leaf;
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;
27typedef struct _LSL_Block LSL_Block; 27typedef struct _LSL_Block LSL_Block;
@@ -30,11 +30,14 @@ typedef struct _LSL_State LSL_State;
30typedef struct _LSL_Script LSL_Script; 30typedef struct _LSL_Script LSL_Script;
31typedef struct _LSL_AST LSL_AST; 31typedef struct _LSL_AST LSL_AST;
32 32
33extern LSL_Token **tokens;
34extern int lowestToken;
35
33typedef int LSL_Type; 36typedef int LSL_Type;
34 37
35typedef void (*convertToken2Lua) (LSL_Leaf *content); 38typedef void (*convertToken2Lua) (LSL_Leaf *content);
36typedef void (*outputToken) (LSL_Leaf *content); 39typedef void (*outputToken) (LSL_Leaf *content);
37typedef void (*evaluateToken) (LSL_Leaf *content, LSL_Value *left, LSL_Value *right); 40typedef void (*evaluateToken) (LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right);
38 41
39#ifndef FALSE 42#ifndef FALSE
40typedef enum 43typedef enum
@@ -55,7 +58,7 @@ typedef enum
55 LSL_CREATION = 32 58 LSL_CREATION = 32
56} LSL_Flags; 59} LSL_Flags;
57 60
58typedef struct 61struct _LSL_Token
59{ 62{
60 LSL_Type type; 63 LSL_Type type;
61 char *token; 64 char *token;
@@ -63,7 +66,7 @@ typedef struct
63 outputToken output; 66 outputToken output;
64 convertToken2Lua convert; 67 convertToken2Lua convert;
65 evaluateToken evaluate; 68 evaluateToken evaluate;
66} LSL_Token; 69};
67 70
68struct _LSL_Leaf 71struct _LSL_Leaf
69{ 72{
@@ -72,13 +75,13 @@ struct _LSL_Leaf
72 char *commentValue; 75 char *commentValue;
73 char *spaceValue; 76 char *spaceValue;
74 77
75 LSL_Type operationValue; 78 LSL_Type operationValue;
76 LSL_AST *expressionValue; 79 LSL_AST *expressionValue;
77 80
78 float floatValue; 81 float floatValue;
79 int integerValue; 82 int integerValue;
80 char *keyValue; 83 char *keyValue;
81 LSL_Leaf *listValue; 84 LSL_Leaf *listValue;
82 char *stringValue; 85 char *stringValue;
83 float vectorValue[3]; 86 float vectorValue[3];
84 float rotationValue[4]; 87 float rotationValue[4];
@@ -97,34 +100,29 @@ struct _LSL_Leaf
97 LSL_Statement *whileValue; 100 LSL_Statement *whileValue;
98 LSL_Statement *statementValue; 101 LSL_Statement *statementValue;
99 102
100 LSL_Block *blockValue; 103 LSL_Block *blockValue;
101 LSL_Identifier *parameterValue; 104 LSL_Identifier *parameterValue;
102 LSL_Function *functionValue; 105 LSL_Function *functionValue;
103 LSL_State *stateValue; 106 LSL_State *stateValue;
104 LSL_Script *scriptValue; 107 LSL_Script *scriptValue;
105 108
106 char *unknownValue; 109 char *unknownValue;
107 } value; 110 } value;
108 char *ignorableText; 111 char *ignorableText;
109 int line, column; 112 LSL_Token *token;
110};
111
112struct _LSL_Value
113{
114 LSL_Leaf content;
115 LSL_Type type; 113 LSL_Type type;
114 int line, column;
116}; 115};
117 116
118struct _LSL_Identifier // For variables and function parameters. 117struct _LSL_Identifier // For variables and function parameters.
119{ 118{
120 char *name; 119 char *name;
121 LSL_Value value; 120 LSL_Leaf value;
122}; 121};
123 122
124struct _LSL_Statement 123struct _LSL_Statement
125{ 124{
126 LSL_AST *expression; 125 LSL_AST *expressions; /// For things like a for statement, might hold three expressions.
127 LSL_Type type;
128}; 126};
129 127
130struct _LSL_Block 128struct _LSL_Block
@@ -137,7 +135,7 @@ struct _LSL_Function
137 char *name; 135 char *name;
138 LSL_Block block; 136 LSL_Block block;
139 LSL_Identifier *parameters; 137 LSL_Identifier *parameters;
140 LSL_Type type; 138 LSL_Type type; // Return type.
141}; 139};
142 140
143struct _LSL_State 141struct _LSL_State
@@ -158,10 +156,7 @@ struct _LSL_AST
158{ 156{
159 LSL_AST *left; 157 LSL_AST *left;
160 LSL_AST *right; 158 LSL_AST *right;
161 LSL_Token *token;
162 LSL_Leaf content; 159 LSL_Leaf content;
163 int line;
164 int character;
165}; 160};
166 161
167 162