diff options
Diffstat (limited to 'LuaSL/src/LuaSL_compile.c')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 8bbffe0..dc2dd5c 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -239,7 +239,7 @@ void burnLeaf(void *data) | |||
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->ignorable); |
243 | //#endif | 243 | //#endif |
244 | // free(leaf); | 244 | // free(leaf); |
245 | } | 245 | } |
@@ -454,8 +454,8 @@ LSL_Leaf *addBlock(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL | |||
454 | #if LUASL_DIFF_CHECK | 454 | #if LUASL_DIFF_CHECK |
455 | if ((left) && (right)) | 455 | if ((left) && (right)) |
456 | { | 456 | { |
457 | left->value.blockValue->closeIgnorableText = right->ignorableText; | 457 | left->value.blockValue->closeIgnorable = right->ignorable; |
458 | right->ignorableText = NULL; | 458 | right->ignorable = NULL; |
459 | } | 459 | } |
460 | #endif | 460 | #endif |
461 | return lval; | 461 | return lval; |
@@ -479,8 +479,8 @@ LSL_Leaf *addParameter(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *ident | |||
479 | { | 479 | { |
480 | result->name.text = identifier->value.stringValue; | 480 | result->name.text = identifier->value.stringValue; |
481 | #if LUASL_DIFF_CHECK | 481 | #if LUASL_DIFF_CHECK |
482 | result->name.ignorableText = identifier->ignorableText; | 482 | result->name.ignorable = identifier->ignorable; |
483 | identifier->ignorableText = NULL; | 483 | identifier->ignorable = NULL; |
484 | #endif | 484 | #endif |
485 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; | 485 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; |
486 | identifier->value.identifierValue = result; | 486 | identifier->value.identifierValue = result; |
@@ -549,8 +549,8 @@ LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
549 | { | 549 | { |
550 | func->name.text = identifier->value.stringValue; | 550 | func->name.text = identifier->value.stringValue; |
551 | #if LUASL_DIFF_CHECK | 551 | #if LUASL_DIFF_CHECK |
552 | func->name.ignorableText = identifier->ignorableText; | 552 | func->name.ignorable = identifier->ignorable; |
553 | identifier->ignorableText = NULL; | 553 | identifier->ignorable = NULL; |
554 | #endif | 554 | #endif |
555 | identifier->toKen = tokens[LSL_FUNCTION - lowestToken]; | 555 | identifier->toKen = tokens[LSL_FUNCTION - lowestToken]; |
556 | identifier->value.functionValue = func; | 556 | identifier->value.functionValue = func; |
@@ -558,8 +558,8 @@ LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
558 | { | 558 | { |
559 | func->type.text = type->toKen->toKen; | 559 | func->type.text = type->toKen->toKen; |
560 | #if LUASL_DIFF_CHECK | 560 | #if LUASL_DIFF_CHECK |
561 | func->type.ignorableText = type->ignorableText; | 561 | func->type.ignorable = type->ignorable; |
562 | type->ignorableText = NULL; | 562 | type->ignorable = NULL; |
563 | #endif | 563 | #endif |
564 | identifier->basicType = type->basicType; | 564 | identifier->basicType = type->basicType; |
565 | } | 565 | } |
@@ -634,9 +634,9 @@ LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Type type, LSL_Leaf | |||
634 | parens->contents = expr; | 634 | parens->contents = expr; |
635 | parens->type = type; | 635 | parens->type = type; |
636 | #if LUASL_DIFF_CHECK | 636 | #if LUASL_DIFF_CHECK |
637 | parens->rightIgnorableText = rval->ignorableText; | 637 | parens->rightIgnorable = rval->ignorable; |
638 | // Actualy, at this point, rval is no longer needed. | 638 | // Actualy, at this point, rval is no longer needed. |
639 | rval->ignorableText = NULL; | 639 | rval->ignorable = NULL; |
640 | #endif | 640 | #endif |
641 | if (lval) | 641 | if (lval) |
642 | { | 642 | { |
@@ -656,15 +656,16 @@ LSL_Leaf *addState(LuaSL_compiler *compiler, LSL_Leaf *state, LSL_Leaf *identifi | |||
656 | { | 656 | { |
657 | result->name.text = identifier->value.stringValue; | 657 | result->name.text = identifier->value.stringValue; |
658 | #if LUASL_DIFF_CHECK | 658 | #if LUASL_DIFF_CHECK |
659 | result->name.ignorableText = identifier->ignorableText; | 659 | result->name.ignorable = identifier->ignorable; |
660 | identifier->ignorableText = NULL; | 660 | identifier->ignorable = NULL; |
661 | #endif | 661 | #endif |
662 | result->block = block->value.blockValue; | 662 | result->block = block->value.blockValue; |
663 | if (state) | 663 | if (state) |
664 | { | 664 | { |
665 | result->state.text = state->toKen->toKen; | 665 | result->state.text = state->toKen->toKen; |
666 | #if LUASL_DIFF_CHECK | 666 | #if LUASL_DIFF_CHECK |
667 | result->state.ignorableText = state->ignorableText; | 667 | result->state.ignorable = state->ignorable; |
668 | state->ignorable = NULL; | ||
668 | #endif | 669 | #endif |
669 | } | 670 | } |
670 | identifier->value.stateValue = result; | 671 | identifier->value.stateValue = result; |
@@ -824,8 +825,8 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
824 | { | 825 | { |
825 | result->name.text = identifier->value.stringValue; | 826 | result->name.text = identifier->value.stringValue; |
826 | #if LUASL_DIFF_CHECK | 827 | #if LUASL_DIFF_CHECK |
827 | result->name.ignorableText = identifier->ignorableText; | 828 | result->name.ignorable = identifier->ignorable; |
828 | identifier->ignorableText = NULL; | 829 | identifier->ignorable = NULL; |
829 | #endif | 830 | #endif |
830 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; | 831 | result->value.toKen = tokens[LSL_UNKNOWN - lowestToken]; |
831 | identifier->value.identifierValue = result; | 832 | identifier->value.identifierValue = result; |
@@ -860,8 +861,8 @@ LSL_Leaf *beginBlock(LuaSL_compiler *compiler, LSL_Leaf *block) | |||
860 | block->value.blockValue = blok; | 861 | block->value.blockValue = blok; |
861 | blok->outerBlock = compiler->currentBlock; | 862 | blok->outerBlock = compiler->currentBlock; |
862 | #if LUASL_DIFF_CHECK | 863 | #if LUASL_DIFF_CHECK |
863 | blok->openIgnorableText = block->ignorableText; | 864 | blok->openIgnorable = block->ignorable; |
864 | block->ignorableText = NULL; | 865 | block->ignorable = NULL; |
865 | #endif | 866 | #endif |
866 | compiler->currentBlock = blok; | 867 | compiler->currentBlock = blok; |
867 | blok->function = compiler->currentFunction; | 868 | blok->function = compiler->currentFunction; |
@@ -1238,8 +1239,8 @@ static void outputLeaf(FILE *file, outputMode mode, LSL_Leaf *leaf) | |||
1238 | { | 1239 | { |
1239 | outputLeaf(file, mode, leaf->left); | 1240 | outputLeaf(file, mode, leaf->left); |
1240 | #if LUASL_DIFF_CHECK | 1241 | #if LUASL_DIFF_CHECK |
1241 | if ((!(LSL_NOIGNORE & leaf->toKen->flags)) && (leaf->ignorableText)) | 1242 | if ((!(LSL_NOIGNORE & leaf->toKen->flags)) && (leaf->ignorable)) |
1242 | fwrite(eina_strbuf_string_get(leaf->ignorableText), 1, eina_strbuf_length_get(leaf->ignorableText), file); | 1243 | fwrite(eina_strbuf_string_get(leaf->ignorable), 1, eina_strbuf_length_get(leaf->ignorable), file); |
1243 | #endif | 1244 | #endif |
1244 | if (leaf->toKen->output) | 1245 | if (leaf->toKen->output) |
1245 | leaf->toKen->output(file, mode, leaf); | 1246 | leaf->toKen->output(file, mode, leaf); |
@@ -1259,8 +1260,8 @@ static void outputRawBlock(FILE *file, outputMode mode, LSL_Block *block) | |||
1259 | LSL_Statement *stat = NULL; | 1260 | LSL_Statement *stat = NULL; |
1260 | 1261 | ||
1261 | #if LUASL_DIFF_CHECK | 1262 | #if LUASL_DIFF_CHECK |
1262 | if (block->openIgnorableText) | 1263 | if (block->openIgnorable) |
1263 | fwrite(eina_strbuf_string_get(block->openIgnorableText), 1, eina_strbuf_length_get(block->openIgnorableText), file); | 1264 | fwrite(eina_strbuf_string_get(block->openIgnorable), 1, eina_strbuf_length_get(block->openIgnorable), file); |
1264 | fprintf(file, "{"); | 1265 | fprintf(file, "{"); |
1265 | #else | 1266 | #else |
1266 | fprintf(file, "\n{\n"); | 1267 | fprintf(file, "\n{\n"); |
@@ -1270,8 +1271,8 @@ static void outputRawBlock(FILE *file, outputMode mode, LSL_Block *block) | |||
1270 | outputRawStatement(file, mode, stat); | 1271 | outputRawStatement(file, mode, stat); |
1271 | } | 1272 | } |
1272 | #if LUASL_DIFF_CHECK | 1273 | #if LUASL_DIFF_CHECK |
1273 | if (block->closeIgnorableText) | 1274 | if (block->closeIgnorable) |
1274 | fwrite(eina_strbuf_string_get(block->closeIgnorableText), 1, eina_strbuf_length_get(block->closeIgnorableText), file); | 1275 | fwrite(eina_strbuf_string_get(block->closeIgnorable), 1, eina_strbuf_length_get(block->closeIgnorable), file); |
1275 | #endif | 1276 | #endif |
1276 | fprintf(file, "}"); | 1277 | fprintf(file, "}"); |
1277 | } | 1278 | } |
@@ -1286,7 +1287,7 @@ static void outputRawParenthesisToken(FILE *file, outputMode mode, LSL_Parenthes | |||
1286 | else | 1287 | else |
1287 | outputLeaf(file, mode, parenthesis->contents); | 1288 | outputLeaf(file, mode, parenthesis->contents); |
1288 | #if LUASL_DIFF_CHECK | 1289 | #if LUASL_DIFF_CHECK |
1289 | fprintf(file, "%s)", eina_strbuf_string_get(parenthesis->rightIgnorableText)); | 1290 | fprintf(file, "%s)", eina_strbuf_string_get(parenthesis->rightIgnorable)); |
1290 | #else | 1291 | #else |
1291 | fprintf(file, ")"); | 1292 | fprintf(file, ")"); |
1292 | #endif | 1293 | #endif |
@@ -1396,8 +1397,8 @@ static void outputText(FILE *file, LSL_Text *text, boolean ignore) | |||
1396 | if (text->text) | 1397 | if (text->text) |
1397 | { | 1398 | { |
1398 | #if LUASL_DIFF_CHECK | 1399 | #if LUASL_DIFF_CHECK |
1399 | if (ignore && (text->ignorableText)) | 1400 | if (ignore && (text->ignorable)) |
1400 | fwrite(eina_strbuf_string_get(text->ignorableText), 1, eina_strbuf_length_get(text->ignorableText), file); | 1401 | fwrite(eina_strbuf_string_get(text->ignorable), 1, eina_strbuf_length_get(text->ignorable), file); |
1401 | #endif | 1402 | #endif |
1402 | fprintf(file, "%s", text->text); | 1403 | fprintf(file, "%s", text->text); |
1403 | } | 1404 | } |
@@ -1617,7 +1618,7 @@ boolean compileLSL(gameGlobals *game, char *script, boolean doConstants) | |||
1617 | compiler.script.variables = eina_hash_stringshared_new(burnLeaf); | 1618 | compiler.script.variables = eina_hash_stringshared_new(burnLeaf); |
1618 | eina_clist_init(&(compiler.danglingCalls)); | 1619 | eina_clist_init(&(compiler.danglingCalls)); |
1619 | #if LUASL_DIFF_CHECK | 1620 | #if LUASL_DIFF_CHECK |
1620 | compiler.ignorableText = eina_strbuf_new(); | 1621 | compiler.ignorable = eina_strbuf_new(); |
1621 | #endif | 1622 | #endif |
1622 | 1623 | ||
1623 | strncpy(compiler.fileName, script, PATH_MAX - 1); | 1624 | strncpy(compiler.fileName, script, PATH_MAX - 1); |