diff options
author | David Walter Seikel | 2012-01-23 19:53:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 19:53:39 +1000 |
commit | c6daef3caeccec6086f693ab9fe038517015ed8d (patch) | |
tree | ba32e0afd9a0c4f39983c1e326364cbaed6cf92d | |
parent | Implement assignments. (diff) | |
download | SledjHamr-c6daef3caeccec6086f693ab9fe038517015ed8d.zip SledjHamr-c6daef3caeccec6086f693ab9fe038517015ed8d.tar.gz SledjHamr-c6daef3caeccec6086f693ab9fe038517015ed8d.tar.bz2 SledjHamr-c6daef3caeccec6086f693ab9fe038517015ed8d.tar.xz |
Make some operations valid.
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 5 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 16 |
2 files changed, 15 insertions, 6 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 4f0ab34..687c56c 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -75,6 +75,8 @@ typedef enum | |||
75 | LSL_NOIGNORE = 64 | 75 | LSL_NOIGNORE = 64 |
76 | } LSL_Flags; | 76 | } LSL_Flags; |
77 | 77 | ||
78 | |||
79 | // VERY IMPORTANT to keep this in sync with allowedTypes allowed[] from LuaSL_compile.c! | ||
78 | typedef enum | 80 | typedef enum |
79 | { | 81 | { |
80 | OT_nothing, | 82 | OT_nothing, |
@@ -90,6 +92,7 @@ typedef enum | |||
90 | OT_other, | 92 | OT_other, |
91 | 93 | ||
92 | OT_boolBool, | 94 | OT_boolBool, |
95 | OT_intBool, | ||
93 | OT_intInt, | 96 | OT_intInt, |
94 | OT_intFloat, | 97 | OT_intFloat, |
95 | OT_floatInt, | 98 | OT_floatInt, |
@@ -99,8 +102,10 @@ typedef enum | |||
99 | OT_stringKey, | 102 | OT_stringKey, |
100 | OT_stringString, | 103 | OT_stringString, |
101 | OT_listList, | 104 | OT_listList, |
105 | OT_listBool, | ||
102 | OT_listInt, | 106 | OT_listInt, |
103 | OT_listFloat, | 107 | OT_listFloat, |
108 | OT_listString, | ||
104 | OT_intList, | 109 | OT_intList, |
105 | OT_floatList, | 110 | OT_floatList, |
106 | OT_listOther, | 111 | OT_listOther, |
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index f84b1e1..2fa027a 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -146,6 +146,7 @@ LSL_Token LSL_Tokens[] = | |||
146 | {999999, ST_NONE, NULL, LSL_NONE, NULL, NULL} | 146 | {999999, ST_NONE, NULL, LSL_NONE, NULL, NULL} |
147 | }; | 147 | }; |
148 | 148 | ||
149 | // VERY IMPORTANT to keep this in sync with enum opType from LuaSL_LSL_tree.h! | ||
149 | allowedTypes allowed[] = | 150 | allowedTypes allowed[] = |
150 | { | 151 | { |
151 | {OT_nothing, "nothing", (ST_NONE)}, // | 152 | {OT_nothing, "nothing", (ST_NONE)}, // |
@@ -162,6 +163,7 @@ allowedTypes allowed[] = | |||
162 | 163 | ||
163 | {OT_bool, "boolean", (ST_BOOLEAN | ST_EQUALITY)}, // bool bool == != = && || | 164 | {OT_bool, "boolean", (ST_BOOLEAN | ST_EQUALITY)}, // bool bool == != = && || |
164 | 165 | ||
166 | {OT_integer, "integer", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO | ST_BITWISE)}, // int boolean * / + - % == != < > <= >= = += -= *= /= %= & | ^ << >> | ||
165 | {OT_integer, "integer", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO | ST_BITWISE)}, // int int * / + - % == != < > <= >= = += -= *= /= %= & | ^ << >> | 167 | {OT_integer, "integer", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO | ST_BITWISE)}, // int int * / + - % == != < > <= >= = += -= *= /= %= & | ^ << >> |
166 | {OT_float, "float", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, // int float cast to float float | 168 | {OT_float, "float", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, // int float cast to float float |
167 | {OT_float, "float", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, // float int cast to float float | 169 | {OT_float, "float", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, // float int cast to float float |
@@ -172,15 +174,17 @@ allowedTypes allowed[] = | |||
172 | {OT_string, "string", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, // string key cast to string string | 174 | {OT_string, "string", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, // string key cast to string string |
173 | {OT_string, "string", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, // string string + == != = += | 175 | {OT_string, "string", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, // string string + == != = += |
174 | 176 | ||
175 | {OT_list, "list", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, // list list + == != = += | 177 | {OT_list, "list", (ST_ADD | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT )}, // list list + == != = += |
176 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION)}, // list integer + < > <= >= = += | 178 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT )}, // list boolean + < > <= >= = += |
177 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION)}, // list float + < > <= >= = += | 179 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT )}, // list integer + < > <= >= = += |
180 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT )}, // list float + < > <= >= = += | ||
181 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT )}, // list string + < > <= >= = += | ||
178 | {OT_integer, "integer", (ST_ADD | ST_COMPARISON)}, // integer list + < > <= >= | 182 | {OT_integer, "integer", (ST_ADD | ST_COMPARISON)}, // integer list + < > <= >= |
179 | {OT_float, "float", (ST_ADD | ST_COMPARISON)}, // float list + < > <= >= | 183 | {OT_float, "float", (ST_ADD | ST_COMPARISON)}, // float list + < > <= >= |
180 | {OT_list, "list", (ST_ADD | ST_CONCATENATION)}, // list other + = += | 184 | {OT_list, "list", (ST_ADD | ST_CONCATENATION)}, // list other + = += |
181 | 185 | ||
182 | {OT_vector, "vector", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO)}, // vector vector * / + - % == != = += -= *= /= %= | 186 | {OT_vector, "vector", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO)}, // vector vector * / + - % == != = += -= *= /= %= |
183 | {OT_vector, "vector", (ST_MULTIPLY)}, // vector float * / | 187 | {OT_vector, "vector", (ST_MULTIPLY | ST_ASSIGNMENT)}, // vector float * / *= /= |
184 | {OT_vector, "vector", (ST_MULTIPLY)}, // vector rotation * / | 188 | {OT_vector, "vector", (ST_MULTIPLY)}, // vector rotation * / |
185 | 189 | ||
186 | {OT_rotation, "rotation", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT)}, // rotation rotation * / + - == != = += -= *= /= | 190 | {OT_rotation, "rotation", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT)}, // rotation rotation * / + - == != = += -= *= /= |
@@ -194,10 +198,10 @@ opType opExpr[][10] = | |||
194 | { | 198 | { |
195 | {OT_nothing, OT_bool, OT_integer, OT_float, OT_key, OT_list, OT_rotation, OT_string, OT_vector, OT_other}, | 199 | {OT_nothing, OT_bool, OT_integer, OT_float, OT_key, OT_list, OT_rotation, OT_string, OT_vector, OT_other}, |
196 | {OT_bool, OT_boolBool, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid}, | 200 | {OT_bool, OT_boolBool, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid}, |
197 | {OT_integer, OT_invalid, OT_intInt, OT_intFloat, OT_invalid, OT_intList, OT_invalid, OT_invalid, OT_invalid, OT_invalid}, | 201 | {OT_integer, OT_intBool, OT_intInt, OT_intFloat, OT_invalid, OT_intList, OT_invalid, OT_invalid, OT_invalid, OT_invalid}, |
198 | {OT_float, OT_invalid, OT_floatInt, OT_floatFloat, OT_invalid, OT_floatList, OT_invalid, OT_invalid, OT_invalid, OT_invalid}, | 202 | {OT_float, OT_invalid, OT_floatInt, OT_floatFloat, OT_invalid, OT_floatList, OT_invalid, OT_invalid, OT_invalid, OT_invalid}, |
199 | {OT_key, OT_invalid, OT_invalid, OT_invalid, OT_keyKey, OT_invalid, OT_invalid, OT_keyString, OT_invalid, OT_invalid}, | 203 | {OT_key, OT_invalid, OT_invalid, OT_invalid, OT_keyKey, OT_invalid, OT_invalid, OT_keyString, OT_invalid, OT_invalid}, |
200 | {OT_list, OT_invalid, OT_listInt, OT_listFloat, OT_invalid, OT_listList, OT_invalid, OT_invalid, OT_invalid, OT_listOther}, | 204 | {OT_list, OT_listBool, OT_listInt, OT_listFloat, OT_invalid, OT_listList, OT_invalid, OT_listString, OT_invalid, OT_listOther}, |
201 | {OT_rotation, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_rotationRotation, OT_invalid, OT_invalid, OT_invalid}, | 205 | {OT_rotation, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_invalid, OT_rotationRotation, OT_invalid, OT_invalid, OT_invalid}, |
202 | {OT_string, OT_invalid, OT_invalid, OT_invalid, OT_stringKey, OT_invalid, OT_invalid, OT_stringString, OT_invalid, OT_invalid}, | 206 | {OT_string, OT_invalid, OT_invalid, OT_invalid, OT_stringKey, OT_invalid, OT_invalid, OT_stringString, OT_invalid, OT_invalid}, |
203 | {OT_vector, OT_invalid, OT_invalid, OT_vectorFloat, OT_invalid, OT_invalid, OT_vectorRotation, OT_invalid, OT_vectorVector, OT_invalid}, | 207 | {OT_vector, OT_invalid, OT_invalid, OT_vectorFloat, OT_invalid, OT_invalid, OT_vectorRotation, OT_invalid, OT_vectorVector, OT_invalid}, |