aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_LSL_tree.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h180
1 files changed, 98 insertions, 82 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 257f18b..adefa07 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -19,8 +19,24 @@ extern int yydebug;
19 19
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
23typedef union _LSL_Leaf LSL_Leaf;
24typedef struct _LSL_Value LSL_Value;
25typedef struct _LSL_Identifier LSL_Identifier;
26typedef struct _LSL_Statement LSL_Statement;
27typedef struct _LSL_Block LSL_Block;
28typedef struct _LSL_Function LSL_Function;
29typedef struct _LSL_State LSL_State;
30typedef struct _LSL_Script LSL_Script;
31typedef struct _LSL_AST LSL_AST;
32
33typedef int LSL_Type;
34
35typedef void (*convertToken2Lua) (LSL_Leaf *content);
36typedef void (*outputToken) (LSL_Leaf *content);
37typedef void (*evaluateToken) (LSL_Leaf *content, LSL_Value *left, LSL_Value *right);
38
22#ifndef FALSE 39#ifndef FALSE
23// NEVER change this
24typedef enum 40typedef enum
25{ 41{
26 FALSE = 0, 42 FALSE = 0,
@@ -39,111 +55,111 @@ typedef enum
39 LSL_CREATION = 32 55 LSL_CREATION = 32
40} LSL_Flags; 56} LSL_Flags;
41 57
42typedef int LSL_Type;
43
44typedef struct 58typedef struct
45{ 59{
46 LSL_Type type; 60 LSL_Type type;
47 struct LSL_AST *expression; 61 char *token;
48} LSL_Statement; 62 LSL_Flags flags;
63 outputToken output;
64 convertToken2Lua convert;
65 evaluateToken evaluate;
66} LSL_Token;
49 67
50typedef struct 68union _LSL_Leaf
51{ 69{
52 LSL_Statement *statements; 70 char *commentValue;
53} LSL_Block; 71 char *spaceValue;
54 72
55typedef struct 73 LSL_Type operationValue;
74 LSL_AST *expressionValue;
75
76 float floatValue;
77 int integerValue;
78 char *keyValue;
79 LSL_Leaf *listValue;
80 char *stringValue;
81 float vectorValue[3];
82 float rotationValue[4];
83
84 LSL_Identifier *variableValue;
85
86 char *labelValue;
87 LSL_Statement *doValue;
88 LSL_Statement *forValue;
89 LSL_Statement *elseIfValue;
90 LSL_Statement *elseValue;
91 LSL_Statement *ifValue;
92 char *jumpValue;
93 LSL_Statement *returnValue;
94 char *stateChangeValue;
95 LSL_Statement *whileValue;
96 LSL_Statement *statementValue;
97
98 LSL_Block *blockValue;
99 LSL_Identifier *parameterValue;
100 LSL_Function *functionValue;
101 LSL_State *stateValue;
102 LSL_Script *scriptValue;
103
104 char *unknownValue;
105};
106
107struct _LSL_Value
56{ 108{
57 char *name; 109 LSL_Leaf content;
58 struct LSL_Identifier *parameters; 110 LSL_Type type;
59 LSL_Block block; 111};
60 LSL_Type type;
61} LSL_Function;
62 112
63typedef struct 113struct _LSL_Identifier // For variables and function parameters.
64{ 114{
65 char *name; 115 char *name;
66 LSL_Function *handlers; 116 LSL_Value value;
67} LSL_State; 117};
68 118
69typedef struct 119struct _LSL_Statement
70{ 120{
71 char *name; 121 LSL_AST *expression;
72 struct LSL_Identifier *variables; 122 LSL_Type type;
73 LSL_Function *functions; 123};
74 LSL_State *states;
75} LSL_Script;
76 124
77typedef union LSL_Leaf 125struct _LSL_Block
78{ 126{
79 char *spaceValue; 127 LSL_Statement *statements;
80 char *commentValue; 128};
81 LSL_Type typeValue;
82 char *nameValue;
83 struct LSL_Identifier *identifierValue;
84 float floatValue;
85 int integerValue;
86 char *stringValue;
87 char *keyValue;
88 float vectorValue[3];
89 float rotationValue[4];
90 union LSL_Leaf *listValue;
91 char *labelValue;
92 LSL_Type operationValue;
93 struct LSL_AST *expressionValue;
94 LSL_Statement *doValue;
95 LSL_Statement *forValue;
96 LSL_Statement *ifValue;
97 LSL_Statement *elseValue;
98 LSL_Statement *elseIfValue;
99 char *jumpValue;
100 char *stateChangeValue;
101 LSL_Statement *statementValue;
102 struct LSL_Identifier *parameterValue;
103 LSL_Function *functionValue;
104 LSL_State *stateValue;
105 LSL_Script *scriptValue;
106 char *unknownValue;
107} LSL_Leaf;
108 129
109typedef struct 130struct _LSL_Function
110{ 131{
132 char *name;
133 LSL_Block block;
134 LSL_Identifier *parameters;
111 LSL_Type type; 135 LSL_Type type;
112 LSL_Leaf content; 136};
113} LSL_Value;
114
115typedef void (*convertToken2Lua) (LSL_Leaf *content);
116typedef void (*outputToken) (LSL_Leaf *content);
117typedef void (*evaluateToken) (LSL_Leaf *content, LSL_Value *left, LSL_Value *right);
118 137
119typedef struct 138struct _LSL_State
120{ 139{
121 LSL_Type type; 140 char *name;
122 char *token; 141 LSL_Function *handlers;
123 LSL_Flags flags; 142};
124 outputToken output;
125 convertToken2Lua convert;
126 evaluateToken evaluate;
127} LSL_Token;
128 143
129typedef struct 144struct _LSL_Script
130{ 145{
131 char *name; 146 char *name;
132 LSL_Type type; 147 LSL_Function *functions;
133 LSL_Leaf content; 148 LSL_State *states;
134} LSL_Identifier; 149 LSL_Identifier *variables;
150};
135 151
136typedef struct LSL_AST 152struct _LSL_AST
137{ 153{
138 struct LSL_AST *left; 154 LSL_AST *left;
139 struct LSL_AST *right; 155 LSL_AST *right;
140 int line;
141 int character;
142 LSL_Token *token; 156 LSL_Token *token;
143 LSL_Leaf content; 157 LSL_Leaf content;
144} LSL_AST; 158 int line;
159 int character;
160};
161
145 162
146
147// define the type for flex and bison 163// define the type for flex and bison
148#define YYSTYPE LSL_Leaf 164#define YYSTYPE LSL_Leaf
149 165