diff options
author | David Walter Seikel | 2012-01-22 09:25:54 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-22 09:25:54 +1000 |
commit | 9eabfaf4aa7864be493df221318507335d777e49 (patch) | |
tree | 61a993e627dc58a157d8dd136bb1ed1f3bc1419b /LuaSL/src/LuaSL_compile.c | |
parent | Let "state default;" work. (diff) | |
download | SledjHamr-9eabfaf4aa7864be493df221318507335d777e49.zip SledjHamr-9eabfaf4aa7864be493df221318507335d777e49.tar.gz SledjHamr-9eabfaf4aa7864be493df221318507335d777e49.tar.bz2 SledjHamr-9eabfaf4aa7864be493df221318507335d777e49.tar.xz |
Patch up a few expression things so that all the MLP scripts parse.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 18deda3..5f3b646 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -151,11 +151,11 @@ allowedTypes allowed[] = | |||
151 | 151 | ||
152 | {OT_bool, "boolean", (ST_BOOL_NOT)}, // bool ! | 152 | {OT_bool, "boolean", (ST_BOOL_NOT)}, // bool ! |
153 | {OT_integer, "integer", (ST_BOOL_NOT | ST_BIT_NOT | ST_NEGATE)}, // int ! - ~ | 153 | {OT_integer, "integer", (ST_BOOL_NOT | ST_BIT_NOT | ST_NEGATE)}, // int ! - ~ |
154 | {OT_float, "float", (ST_BOOL_NOT)}, // float ! - | 154 | {OT_float, "float", (ST_BOOL_NOT | ST_NEGATE)}, // float ! - |
155 | {OT_key, "key", (ST_NONE)}, // | 155 | {OT_key, "key", (ST_BOOL_NOT)}, // key ! |
156 | {OT_list, "list", (ST_NONE)}, // | 156 | {OT_list, "list", (ST_NONE)}, // |
157 | {OT_rotation, "rotation", (ST_NONE)}, // | 157 | {OT_rotation, "rotation", (ST_NONE)}, // |
158 | {OT_string, "string", (ST_NONE)}, // | 158 | {OT_string, "string", (ST_BOOL_NOT)}, // string ! |
159 | {OT_vector, "vector", (ST_NONE)}, // | 159 | {OT_vector, "vector", (ST_NONE)}, // |
160 | {OT_other, "other", (ST_NONE)}, // | 160 | {OT_other, "other", (ST_NONE)}, // |
161 | 161 | ||
@@ -368,41 +368,44 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, | |||
368 | rType = allowed[rType].result; | 368 | rType = allowed[rType].result; |
369 | } | 369 | } |
370 | 370 | ||
371 | // The basic lookup. | 371 | switch (lval->token->subType) |
372 | lval->basicType = opExpr[lType][rType]; | ||
373 | if (OT_invalid != lval->basicType) | ||
374 | { | 372 | { |
375 | // Check if it's an allowed operation. | 373 | case ST_BOOLEAN : |
376 | if (0 == (lval->token->subType & allowed[lval->basicType].subTypes)) | 374 | case ST_COMPARISON : |
377 | { | 375 | case ST_EQUALITY : |
378 | lval->basicType = OT_invalid; | 376 | lval->basicType = OT_bool; |
379 | } | 377 | break; |
380 | else | 378 | default : |
381 | { | 379 | // The basic lookup. |
382 | // Double check the corner cases. | 380 | lval->basicType = opExpr[lType][rType]; |
383 | switch (lval->token->subType) | 381 | if (OT_invalid != lval->basicType) |
384 | { | 382 | { |
385 | case ST_BOOLEAN : | 383 | // Check if it's an allowed operation. |
386 | case ST_COMPARISON : | 384 | if (0 == (lval->token->subType & allowed[lval->basicType].subTypes)) |
387 | case ST_EQUALITY : | 385 | lval->basicType = OT_invalid; |
388 | lval->basicType = OT_bool; | 386 | else |
389 | break; | 387 | { |
390 | case ST_MULTIPLY : | 388 | // Double check the corner cases. |
391 | if (OT_vectorVector == lval->basicType) | 389 | switch (lval->token->subType) |
392 | { | 390 | { |
393 | if (LSL_MULTIPLY == lval->token->type) | 391 | case ST_MULTIPLY : |
394 | { | 392 | if (OT_vectorVector == lval->basicType) |
395 | lval->basicType = OT_float; | 393 | { |
396 | lval->token = tokens[LSL_DOT_PRODUCT - lowestToken]; | 394 | if (LSL_MULTIPLY == lval->token->type) |
397 | } | 395 | { |
398 | else | 396 | lval->basicType = OT_float; |
399 | lval->basicType = OT_vector; | 397 | lval->token = tokens[LSL_DOT_PRODUCT - lowestToken]; |
398 | } | ||
399 | else | ||
400 | lval->basicType = OT_vector; | ||
401 | } | ||
402 | break; | ||
403 | default : | ||
404 | break; | ||
400 | } | 405 | } |
401 | break; | 406 | } |
402 | default : | ||
403 | break; | ||
404 | } | 407 | } |
405 | } | 408 | break; |
406 | } | 409 | } |
407 | if (OT_invalid == lval->basicType) | 410 | if (OT_invalid == lval->basicType) |
408 | { | 411 | { |