diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 3538ad4..4f51ee4 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -466,10 +466,11 @@ LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Type type, LSL_Leaf | |||
466 | 466 | ||
467 | if (parens) | 467 | if (parens) |
468 | { | 468 | { |
469 | parens->left = lval; | ||
470 | parens->contents = expr; | 469 | parens->contents = expr; |
471 | parens->type = type; | 470 | parens->type = type; |
472 | parens->right = rval; | 471 | parens->rightIgnorableText = rval->ignorableText; |
472 | // Actualy, at this point, rval is no longer needed. | ||
473 | // rval->ignorableText = eina_strbuf_new(); | ||
473 | if (lval) | 474 | if (lval) |
474 | { | 475 | { |
475 | lval->value.parenthesis = parens; | 476 | lval->value.parenthesis = parens; |
@@ -512,26 +513,17 @@ LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr) | |||
512 | 513 | ||
513 | LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval, LSL_Leaf *expr) | 514 | LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval, LSL_Leaf *expr) |
514 | { | 515 | { |
515 | LSL_Parenthesis *parens = calloc(1, sizeof(LSL_Parenthesis)); | 516 | addParenthesis(lval, expr, LSL_TYPECAST_OPEN, rval); |
516 | 517 | if (lval) | |
517 | if (parens) | ||
518 | { | 518 | { |
519 | parens->left = lval; | 519 | if (type) |
520 | parens->contents = expr; | 520 | lval->basicType = type->basicType; |
521 | parens->type = LSL_TYPECAST_OPEN; | 521 | // Actualy, at this point, type is no longer needed. |
522 | parens->right = rval; | 522 | lval->token = tokens[LSL_TYPECAST_OPEN - lowestToken]; |
523 | if (lval) | ||
524 | { | ||
525 | lval->value.parenthesis = parens; | ||
526 | if (type) | ||
527 | lval->basicType = type->basicType; | ||
528 | lval->token = tokens[LSL_TYPECAST_OPEN - lowestToken]; | ||
529 | } | ||
530 | if (rval) | ||
531 | { | ||
532 | rval->token = tokens[LSL_TYPECAST_CLOSE - lowestToken]; | ||
533 | } | ||
534 | } | 523 | } |
524 | // if (rval) | ||
525 | // rval->token = tokens[LSL_TYPECAST_CLOSE - lowestToken]; | ||
526 | |||
535 | return lval; | 527 | return lval; |
536 | } | 528 | } |
537 | 529 | ||
@@ -937,9 +929,14 @@ static void outputParenthesisToken(FILE *file, outputMode mode, LSL_Leaf *conten | |||
937 | { | 929 | { |
938 | if (content) | 930 | if (content) |
939 | { | 931 | { |
940 | fprintf(file, "%s", content->token->token); | 932 | fprintf(file, "("); |
941 | outputLeaf(file, mode, content->value.parenthesis->contents); | 933 | if (LSL_TYPECAST_OPEN == content->value.parenthesis->type) |
942 | outputLeaf(file, mode, content->value.parenthesis->right); | 934 | fprintf(file, "%s", allowed[content->basicType].name); // TODO - We are missing the type ignorable text here. |
935 | else | ||
936 | outputLeaf(file, mode, content->value.parenthesis->contents); | ||
937 | fprintf(file, "%s)", eina_strbuf_string_get(content->value.parenthesis->rightIgnorableText)); | ||
938 | if (LSL_TYPECAST_OPEN == content->value.parenthesis->type) | ||
939 | outputLeaf(file, mode, content->value.parenthesis->contents); | ||
943 | } | 940 | } |
944 | } | 941 | } |
945 | 942 | ||