diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.c | 80 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 1 |
2 files changed, 41 insertions, 40 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.c b/LuaSL/src/LuaSL_LSL_tree.c index 3d53ed7..2a9d5d6 100644 --- a/LuaSL/src/LuaSL_LSL_tree.c +++ b/LuaSL/src/LuaSL_LSL_tree.c | |||
@@ -131,38 +131,38 @@ LSL_Token LSL_Tokens[] = | |||
131 | 131 | ||
132 | allowedTypes allowed[] = | 132 | allowedTypes allowed[] = |
133 | { | 133 | { |
134 | {OT_nothing, (ST_NONE)}, | 134 | {OT_nothing, "nothing", (ST_NONE)}, |
135 | 135 | ||
136 | {OT_bool, (ST_BOOL_NOT)}, | 136 | {OT_bool, "boolean", (ST_BOOL_NOT)}, |
137 | {OT_integer, (ST_BIT_NOT | ST_NEGATE)}, | 137 | {OT_integer, "integer", (ST_BIT_NOT | ST_NEGATE)}, |
138 | {OT_float, (ST_NONE)}, | 138 | {OT_float, "float", (ST_NONE)}, |
139 | {OT_key, (ST_NONE)}, | 139 | {OT_key, "key", (ST_NONE)}, |
140 | {OT_list, (ST_NONE)}, | 140 | {OT_list, "list", (ST_NONE)}, |
141 | {OT_rotation, (ST_NONE)}, | 141 | {OT_rotation, "rotation", (ST_NONE)}, |
142 | {OT_string, (ST_NONE)}, | 142 | {OT_string, "string", (ST_NONE)}, |
143 | {OT_vector, (ST_NONE)}, | 143 | {OT_vector, "vector", (ST_NONE)}, |
144 | {OT_other, (ST_NONE)}, | 144 | {OT_other, "other", (ST_NONE)}, |
145 | 145 | ||
146 | {OT_bool, (ST_BOOLEAN | ST_EQUALITY)}, | 146 | {OT_bool, "boolean", (ST_BOOLEAN | ST_EQUALITY)}, |
147 | {OT_integer, (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO | ST_BITWISE)}, | 147 | {OT_integer, "integer", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO | ST_BITWISE)}, |
148 | {OT_float, (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, | 148 | {OT_float, "float", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, |
149 | {OT_float, (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, | 149 | {OT_float, "float", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, |
150 | {OT_float, (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, | 150 | {OT_float, "float", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_COMPARISON | ST_CONCATENATION | ST_ASSIGNMENT)}, |
151 | {OT_string, (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, | 151 | {OT_string, "string", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, |
152 | {OT_string, (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, | 152 | {OT_string, "string", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, |
153 | {OT_string, (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, | 153 | {OT_string, "string", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, |
154 | {OT_list, (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, | 154 | {OT_list, "list", (ST_ADD | ST_EQUALITY | ST_CONCATENATION)}, |
155 | {OT_list, (ST_ADD | ST_COMPARISON | ST_CONCATENATION)}, | 155 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION)}, |
156 | {OT_list, (ST_ADD | ST_COMPARISON | ST_CONCATENATION)}, | 156 | {OT_list, "list", (ST_ADD | ST_COMPARISON | ST_CONCATENATION)}, |
157 | {OT_integer, (ST_ADD | ST_COMPARISON)}, | 157 | {OT_integer, "integer", (ST_ADD | ST_COMPARISON)}, |
158 | {OT_float, (ST_ADD | ST_COMPARISON)}, | 158 | {OT_float, "float", (ST_ADD | ST_COMPARISON)}, |
159 | {OT_list, (ST_ADD | ST_CONCATENATION)}, | 159 | {OT_list, "list", (ST_ADD | ST_CONCATENATION)}, |
160 | {OT_vector, (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO)}, | 160 | {OT_vector, "vector", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT | ST_MODULO)}, |
161 | {OT_vector, (ST_MULTIPLY)}, | 161 | {OT_vector, "vector", (ST_MULTIPLY)}, |
162 | {OT_vector, (ST_MULTIPLY)}, | 162 | {OT_vector, "vector", (ST_MULTIPLY)}, |
163 | {OT_rotation, (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT)}, | 163 | {OT_rotation, "rotation", (ST_MULTIPLY | ST_ADD | ST_SUBTRACT | ST_EQUALITY | ST_CONCATENATION | ST_ASSIGNMENT)}, |
164 | {OT_other, (ST_NONE)}, | 164 | {OT_other, "other", (ST_NONE)}, |
165 | {OT_invalid, (ST_NONE)} | 165 | {OT_invalid, "invalid", (ST_NONE)} |
166 | }; | 166 | }; |
167 | 167 | ||
168 | opType opExpr[][10] = | 168 | opType opExpr[][10] = |
@@ -277,14 +277,14 @@ LSL_Leaf *addOperation(LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) | |||
277 | } | 277 | } |
278 | if (OT_invalid == lval->basicType) | 278 | if (OT_invalid == lval->basicType) |
279 | { | 279 | { |
280 | if ((left) && (right)) | 280 | char *leftType = "", *rightType = ""; |
281 | fprintf(stderr, "Invalid operation [%s %s %s] type at line %d column %d\n", left->token->token, lval->token->token, right->token->token, lval->line, lval->column); | 281 | |
282 | else if (left) | 282 | if (left) |
283 | fprintf(stderr, "Invalid operation [%s %s] type at line %d column %d\n", left->token->token, lval->token->token, lval->line, lval->column); | 283 | leftType = allowed[left->basicType].name; |
284 | else if (left) | 284 | if (right) |
285 | fprintf(stderr, "Invalid operation [%s %s] type at line %d column %d\n", lval->token->token, right->token->token, lval->line, lval->column); | 285 | rightType = allowed[right->basicType].name; |
286 | else | 286 | |
287 | fprintf(stderr, "Invalid operation [%s] type at line %d column %d\n", lval->token->token, lval->line, lval->column); | 287 | fprintf(stderr, "Invalid operation [%s %s %s] @ line %d column %d\n", leftType, lval->token->token, rightType, lval->line, lval->column); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index c33d77d..84610b6 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h | |||
@@ -160,6 +160,7 @@ typedef enum | |||
160 | struct _allowedTypes | 160 | struct _allowedTypes |
161 | { | 161 | { |
162 | opType result; | 162 | opType result; |
163 | char *name; | ||
163 | int subTypes; | 164 | int subTypes; |
164 | }; | 165 | }; |
165 | 166 | ||