diff options
author | David Walter Seikel | 2012-01-30 21:27:22 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-30 21:27:22 +1000 |
commit | 933296616edf6bffdee5f0cc629656183d8d60d8 (patch) | |
tree | 23322e2813f1a9855f56b6ac19a45328491cca6e /LuaSL/src/LuaSL_compile.c | |
parent | Don't go outputting duplicate ignorables for function calls and variable refe... (diff) | |
download | SledjHamr-933296616edf6bffdee5f0cc629656183d8d60d8.zip SledjHamr-933296616edf6bffdee5f0cc629656183d8d60d8.tar.gz SledjHamr-933296616edf6bffdee5f0cc629656183d8d60d8.tar.bz2 SledjHamr-933296616edf6bffdee5f0cc629656183d8d60d8.tar.xz |
Blocks get ignorables now.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 772f01a..09463a9 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -450,6 +450,10 @@ LSL_Leaf *addBlock(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL | |||
450 | { | 450 | { |
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). | 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 | compiler->currentBlock = compiler->currentBlock->outerBlock; | 452 | compiler->currentBlock = compiler->currentBlock->outerBlock; |
453 | #if LUASL_DIFF_CHECK | ||
454 | left->value.blockValue->closeIgnorableText = right->ignorableText; | ||
455 | right->ignorableText = NULL; | ||
456 | #endif | ||
453 | return lval; | 457 | return lval; |
454 | } | 458 | } |
455 | 459 | ||
@@ -834,6 +838,10 @@ LSL_Leaf *beginBlock(LuaSL_compiler *compiler, LSL_Leaf *block) | |||
834 | blok->variables = eina_hash_stringshared_new(burnLeaf); | 838 | blok->variables = eina_hash_stringshared_new(burnLeaf); |
835 | block->value.blockValue = blok; | 839 | block->value.blockValue = blok; |
836 | blok->outerBlock = compiler->currentBlock; | 840 | blok->outerBlock = compiler->currentBlock; |
841 | #if LUASL_DIFF_CHECK | ||
842 | blok->openIgnorableText = block->ignorableText; | ||
843 | block->ignorableText = NULL; | ||
844 | #endif | ||
837 | compiler->currentBlock = blok; | 845 | compiler->currentBlock = blok; |
838 | blok->function = compiler->currentFunction; | 846 | blok->function = compiler->currentFunction; |
839 | compiler->currentFunction = NULL; | 847 | compiler->currentFunction = NULL; |
@@ -1225,23 +1233,27 @@ static void outputRawStatement(FILE *file, outputMode mode, LSL_Statement *state | |||
1225 | 1233 | ||
1226 | static void outputRawBlock(FILE *file, outputMode mode, LSL_Block *block) | 1234 | static void outputRawBlock(FILE *file, outputMode mode, LSL_Block *block) |
1227 | { | 1235 | { |
1228 | if (LUASL_DIFF_CHECK) | ||
1229 | fprintf(file, "\n{"); | ||
1230 | else | ||
1231 | fprintf(file, "\n{\n"); | ||
1232 | if (block) | 1236 | if (block) |
1233 | { | 1237 | { |
1234 | LSL_Statement *stat = NULL; | 1238 | LSL_Statement *stat = NULL; |
1235 | 1239 | ||
1240 | #if LUASL_DIFF_CHECK | ||
1241 | if (block->openIgnorableText) | ||
1242 | fwrite(eina_strbuf_string_get(block->openIgnorableText), 1, eina_strbuf_length_get(block->openIgnorableText), file); | ||
1243 | fprintf(file, "{"); | ||
1244 | #else | ||
1245 | fprintf(file, "\n{\n"); | ||
1246 | #endif | ||
1236 | EINA_CLIST_FOR_EACH_ENTRY(stat, &(block->statements), LSL_Statement, statement) | 1247 | EINA_CLIST_FOR_EACH_ENTRY(stat, &(block->statements), LSL_Statement, statement) |
1237 | { | 1248 | { |
1238 | outputRawStatement(file, mode, stat); | 1249 | outputRawStatement(file, mode, stat); |
1239 | } | 1250 | } |
1240 | } | 1251 | #if LUASL_DIFF_CHECK |
1241 | if (LUASL_DIFF_CHECK) | 1252 | if (block->closeIgnorableText) |
1242 | fprintf(file, "\n}"); | 1253 | fwrite(eina_strbuf_string_get(block->closeIgnorableText), 1, eina_strbuf_length_get(block->closeIgnorableText), file); |
1243 | else | 1254 | #endif |
1244 | fprintf(file, "}"); | 1255 | fprintf(file, "}"); |
1256 | } | ||
1245 | } | 1257 | } |
1246 | 1258 | ||
1247 | static void outputRawParenthesisToken(FILE *file, outputMode mode, LSL_Parenthesis *parenthesis, const char *typeName) | 1259 | static void outputRawParenthesisToken(FILE *file, outputMode mode, LSL_Parenthesis *parenthesis, const char *typeName) |