diff options
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_tree.h')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 95 |
1 files changed, 94 insertions, 1 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 558dc8d..d2d767c 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -30,6 +30,7 @@ extern int yydebug; | |||
30 | // http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. | 30 | // http://w-hat.com/stackdepth is a useful discussion about some aspects of the LL parser. |
31 | 31 | ||
32 | 32 | ||
33 | typedef struct _allowedTypes allowedTypes; | ||
33 | typedef struct _LSL_Token LSL_Token; | 34 | typedef struct _LSL_Token LSL_Token; |
34 | typedef struct _LSL_Leaf LSL_Leaf; | 35 | typedef struct _LSL_Leaf LSL_Leaf; |
35 | typedef struct _LSL_Parenthesis LSL_Parenthesis; | 36 | typedef struct _LSL_Parenthesis LSL_Parenthesis; |
@@ -47,7 +48,7 @@ typedef int LSL_Type; | |||
47 | 48 | ||
48 | typedef void (*convertToken2Lua) (FILE *file, LSL_Leaf *content); | 49 | typedef void (*convertToken2Lua) (FILE *file, LSL_Leaf *content); |
49 | typedef void (*outputToken) (FILE *file, LSL_Leaf *content); | 50 | typedef void (*outputToken) (FILE *file, LSL_Leaf *content); |
50 | typedef void (*evaluateToken) (LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); | 51 | typedef LSL_Leaf * (*evaluateToken) (LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); |
51 | 52 | ||
52 | #ifndef FALSE | 53 | #ifndef FALSE |
53 | typedef enum | 54 | typedef enum |
@@ -69,9 +70,99 @@ typedef enum | |||
69 | LSL_NOIGNORE = 64 | 70 | LSL_NOIGNORE = 64 |
70 | } LSL_Flags; | 71 | } LSL_Flags; |
71 | 72 | ||
73 | typedef enum | ||
74 | { | ||
75 | OT_nothing, | ||
76 | |||
77 | OT_bool, | ||
78 | OT_integer, | ||
79 | OT_float, | ||
80 | OT_key, | ||
81 | OT_list, | ||
82 | OT_rotation, | ||
83 | OT_string, | ||
84 | OT_vector, | ||
85 | OT_other, | ||
86 | |||
87 | OT_boolBool, | ||
88 | OT_intInt, | ||
89 | OT_intFloat, | ||
90 | OT_floatInt, | ||
91 | OT_floatFloat, | ||
92 | OT_keyString, | ||
93 | OT_stringKey, | ||
94 | OT_stringString, | ||
95 | OT_listList, | ||
96 | OT_listInt, | ||
97 | OT_listFloat, | ||
98 | OT_intList, | ||
99 | OT_floatList, | ||
100 | OT_listOther, | ||
101 | OT_vectorVector, | ||
102 | OT_vectorFloat, | ||
103 | OT_vectorRotation, | ||
104 | OT_rotationRotation, | ||
105 | OT_otherOther, | ||
106 | OT_invalid | ||
107 | } opType; | ||
108 | |||
109 | /* | ||
110 | Each op is of a specific type - | ||
111 | |||
112 | bool ! | ||
113 | int - ~ | ||
114 | float - | ||
115 | |||
116 | bool bool && || == != = | ||
117 | int int * / + - % == != < > <= >= = += -= *= /= %= & | ^ << >> | ||
118 | int float cast to float float | ||
119 | float int cast to float float | ||
120 | float float * / + - == != < > <= >= = += -= *= /= | ||
121 | |||
122 | key string cast to string string | ||
123 | string key cast to string string | ||
124 | string string + == != = += | ||
125 | |||
126 | list list + == != = += | ||
127 | list integer/float + < > <= >= = += | ||
128 | integer/float list + < > <= >= | ||
129 | list other + = += | ||
130 | |||
131 | vector vector * / + - % == != = += -= *= /= %= | ||
132 | vector float * / | ||
133 | vector rotation * / | ||
134 | |||
135 | rotation rotation * / + - == != = += -= *= /= | ||
136 | */ | ||
137 | |||
138 | typedef enum | ||
139 | { | ||
140 | ST_NONE = 0, | ||
141 | ST_ASSIGNMENT = 1, // -= *= /= | ||
142 | ST_BIT_NOT = 2, // ~ | ||
143 | ST_BOOL_NOT = 4, // ! | ||
144 | ST_BITWISE = 8, // & | ^ << >> | ||
145 | ST_BOOLEAN = 16, // && !! | ||
146 | ST_COMPARISON = 32, // < > <= >= | ||
147 | ST_CONCATENATION = 64, // = += | ||
148 | ST_EQUALITY = 128, // == != | ||
149 | ST_ADD = 512, // + | ||
150 | ST_SUBTRACT = 1024, // - | ||
151 | ST_NEGATE = 2048, // - | ||
152 | ST_MULTIPLY = 4096, // * / | ||
153 | ST_MODULO = 8192 // % %= | ||
154 | } opSubType; | ||
155 | |||
156 | struct _allowedTypes | ||
157 | { | ||
158 | opType result; | ||
159 | int subTypes; | ||
160 | }; | ||
161 | |||
72 | struct _LSL_Token | 162 | struct _LSL_Token |
73 | { | 163 | { |
74 | LSL_Type type; | 164 | LSL_Type type; |
165 | opSubType subType; | ||
75 | char *token; | 166 | char *token; |
76 | LSL_Flags flags; | 167 | LSL_Flags flags; |
77 | outputToken output; | 168 | outputToken output; |
@@ -86,8 +177,10 @@ struct _LSL_Leaf | |||
86 | LSL_Token *token; | 177 | LSL_Token *token; |
87 | char *ignorableText; | 178 | char *ignorableText; |
88 | int line, column; | 179 | int line, column; |
180 | opType basicType; | ||
89 | union | 181 | union |
90 | { | 182 | { |
183 | opType operationValue; | ||
91 | LSL_Parenthesis *parenthesis; | 184 | LSL_Parenthesis *parenthesis; |
92 | 185 | ||
93 | float floatValue; | 186 | float floatValue; |