diff options
author | David Walter Seikel | 2012-01-30 22:06:21 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-30 22:06:21 +1000 |
commit | 865909c8d7c5fb99d5543e506fbb00017d5e1e2a (patch) | |
tree | 68ffb8cb401a893a934818639decef16092ad266 | |
parent | Ignorables for statements. (diff) | |
download | SledjHamr-865909c8d7c5fb99d5543e506fbb00017d5e1e2a.zip SledjHamr-865909c8d7c5fb99d5543e506fbb00017d5e1e2a.tar.gz SledjHamr-865909c8d7c5fb99d5543e506fbb00017d5e1e2a.tar.bz2 SledjHamr-865909c8d7c5fb99d5543e506fbb00017d5e1e2a.tar.xz |
Clean up the new ignorable code so they compile out when disabled.
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 604a5a8..92542c3 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -238,8 +238,9 @@ void burnLeaf(void *data) | |||
238 | // burnLeaf(leaf->left); | 238 | // burnLeaf(leaf->left); |
239 | // burnLeaf(leaf->right); | 239 | // burnLeaf(leaf->right); |
240 | // TODO - Should free up the value to. | 240 | // TODO - Should free up the value to. |
241 | // if (LUASL_DIFF_CHECK) | 241 | //#if LUASL_DIFF_CHECK |
242 | // eina_strbuf_free(leaf->ignorableText); | 242 | // eina_strbuf_free(leaf->ignorableText); |
243 | //#endif | ||
243 | // free(leaf); | 244 | // free(leaf); |
244 | } | 245 | } |
245 | } | 246 | } |
@@ -451,8 +452,11 @@ LSL_Leaf *addBlock(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL | |||
451 | // Damn, look ahead. The } symbol is getting read (and thus endBlock called) before the last statement in the block is reduced (which actually calls the add*() functions). | 452 | // Damn, look ahead. The } symbol is getting read (and thus endBlock called) before the last statement in the block is reduced (which actually calls the add*() functions). |
452 | compiler->currentBlock = compiler->currentBlock->outerBlock; | 453 | compiler->currentBlock = compiler->currentBlock->outerBlock; |
453 | #if LUASL_DIFF_CHECK | 454 | #if LUASL_DIFF_CHECK |
455 | if ((left) && (right)) | ||
456 | { | ||
454 | left->value.blockValue->closeIgnorableText = right->ignorableText; | 457 | left->value.blockValue->closeIgnorableText = right->ignorableText; |
455 | right->ignorableText = NULL; | 458 | right->ignorableText = NULL; |
459 | } | ||
456 | #endif | 460 | #endif |
457 | return lval; | 461 | return lval; |
458 | } | 462 | } |
@@ -474,8 +478,10 @@ LSL_Leaf *addParameter(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *ident | |||
474 | if ( (identifier) && (result)) | 478 | if ( (identifier) && (result)) |
475 | { | 479 | { |
476 | result->name.text = identifier->value.stringValue; | 480 | result->name.text = identifier->value.stringValue; |
481 | #if LUASL_DIFF_CHECK | ||
477 | result->name.ignorableText = identifier->ignorableText; | 482 | result->name.ignorableText = identifier->ignorableText; |
478 | identifier->ignorableText = NULL; | 483 | identifier->ignorableText = NULL; |
484 | #endif | ||
479 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; | 485 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; |
480 | identifier->value.identifierValue = result; | 486 | identifier->value.identifierValue = result; |
481 | identifier->toKen = tokens[LSL_PARAMETER - lowestToken]; | 487 | identifier->toKen = tokens[LSL_PARAMETER - lowestToken]; |
@@ -542,15 +548,19 @@ LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
542 | if (identifier) | 548 | if (identifier) |
543 | { | 549 | { |
544 | func->name.text = identifier->value.stringValue; | 550 | func->name.text = identifier->value.stringValue; |
551 | #if LUASL_DIFF_CHECK | ||
545 | func->name.ignorableText = identifier->ignorableText; | 552 | func->name.ignorableText = identifier->ignorableText; |
546 | identifier->ignorableText = NULL; | 553 | identifier->ignorableText = NULL; |
554 | #endif | ||
547 | identifier->toKen = tokens[LSL_FUNCTION - lowestToken]; | 555 | identifier->toKen = tokens[LSL_FUNCTION - lowestToken]; |
548 | identifier->value.functionValue = func; | 556 | identifier->value.functionValue = func; |
549 | if (type) | 557 | if (type) |
550 | { | 558 | { |
551 | func->type.text = type->toKen->toKen; | 559 | func->type.text = type->toKen->toKen; |
560 | #if LUASL_DIFF_CHECK | ||
552 | func->type.ignorableText = type->ignorableText; | 561 | func->type.ignorableText = type->ignorableText; |
553 | type->ignorableText = NULL; | 562 | type->ignorableText = NULL; |
563 | #endif | ||
554 | identifier->basicType = type->basicType; | 564 | identifier->basicType = type->basicType; |
555 | } | 565 | } |
556 | else | 566 | else |
@@ -626,7 +636,7 @@ LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Type type, LSL_Leaf | |||
626 | #if LUASL_DIFF_CHECK | 636 | #if LUASL_DIFF_CHECK |
627 | parens->rightIgnorableText = rval->ignorableText; | 637 | parens->rightIgnorableText = rval->ignorableText; |
628 | // Actualy, at this point, rval is no longer needed. | 638 | // Actualy, at this point, rval is no longer needed. |
629 | // rval->ignorableText = eina_strbuf_new(); | 639 | rval->ignorableText = NULL; |
630 | #endif | 640 | #endif |
631 | if (lval) | 641 | if (lval) |
632 | { | 642 | { |
@@ -645,13 +655,17 @@ LSL_Leaf *addState(LuaSL_compiler *compiler, LSL_Leaf *state, LSL_Leaf *identifi | |||
645 | if ((identifier) && (result)) | 655 | if ((identifier) && (result)) |
646 | { | 656 | { |
647 | result->name.text = identifier->value.stringValue; | 657 | result->name.text = identifier->value.stringValue; |
658 | #if LUASL_DIFF_CHECK | ||
648 | result->name.ignorableText = identifier->ignorableText; | 659 | result->name.ignorableText = identifier->ignorableText; |
649 | identifier->ignorableText = NULL; | 660 | identifier->ignorableText = NULL; |
661 | #endif | ||
650 | result->block = block->value.blockValue; | 662 | result->block = block->value.blockValue; |
651 | if (state) | 663 | if (state) |
652 | { | 664 | { |
653 | result->state.text = state->toKen->toKen; | 665 | result->state.text = state->toKen->toKen; |
666 | #if LUASL_DIFF_CHECK | ||
654 | result->state.ignorableText = state->ignorableText; | 667 | result->state.ignorableText = state->ignorableText; |
668 | #endif | ||
655 | } | 669 | } |
656 | identifier->value.stateValue = result; | 670 | identifier->value.stateValue = result; |
657 | identifier->toKen = tokens[LSL_STATE - lowestToken]; | 671 | identifier->toKen = tokens[LSL_STATE - lowestToken]; |
@@ -747,13 +761,14 @@ LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Type type, | |||
747 | 761 | ||
748 | if (lval) | 762 | if (lval) |
749 | { | 763 | { |
764 | #if LUASL_DIFF_CHECK | ||
750 | stat->ignorableText = lval->ignorableText; | 765 | stat->ignorableText = lval->ignorableText; |
751 | lval->ignorableText = NULL; | 766 | lval->ignorableText = NULL; |
767 | #endif | ||
752 | lval->value.statementValue = stat; | 768 | lval->value.statementValue = stat; |
753 | } | 769 | } |
754 | } | 770 | } |
755 | 771 | ||
756 | |||
757 | return lval; | 772 | return lval; |
758 | } | 773 | } |
759 | 774 | ||
@@ -806,8 +821,10 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
806 | if ( (identifier) && (result)) | 821 | if ( (identifier) && (result)) |
807 | { | 822 | { |
808 | result->name.text = identifier->value.stringValue; | 823 | result->name.text = identifier->value.stringValue; |
824 | #if LUASL_DIFF_CHECK | ||
809 | result->name.ignorableText = identifier->ignorableText; | 825 | result->name.ignorableText = identifier->ignorableText; |
810 | identifier->ignorableText = NULL; | 826 | identifier->ignorableText = NULL; |
827 | #endif | ||
811 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; | 828 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; |
812 | identifier->value.identifierValue = result; | 829 | identifier->value.identifierValue = result; |
813 | identifier->toKen = tokens[LSL_VARIABLE - lowestToken]; | 830 | identifier->toKen = tokens[LSL_VARIABLE - lowestToken]; |