aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-30 21:57:43 +1000
committerDavid Walter Seikel2012-01-30 21:57:43 +1000
commit198b19f4d51a3929ad67e79179da8760a3233064 (patch)
tree2e8662c111aaed6bb7367b3cc18cd26966de8dcd /LuaSL/src
parentBlocks get ignorables now. (diff)
downloadSledjHamr-198b19f4d51a3929ad67e79179da8760a3233064.zip
SledjHamr-198b19f4d51a3929ad67e79179da8760a3233064.tar.gz
SledjHamr-198b19f4d51a3929ad67e79179da8760a3233064.tar.bz2
SledjHamr-198b19f4d51a3929ad67e79179da8760a3233064.tar.xz
Ignorables for statements.
Diffstat (limited to 'LuaSL/src')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h3
-rw-r--r--LuaSL/src/LuaSL_compile.c21
2 files changed, 14 insertions, 10 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 7e59075..75786d1 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -226,6 +226,9 @@ struct _LSL_Statement
226 LSL_Leaf *expressions; // A for statement will have three expressions, everything else has zero or one. 226 LSL_Leaf *expressions; // A for statement will have three expressions, everything else has zero or one.
227 LSL_Block *block; 227 LSL_Block *block;
228 LSL_Type type; // Expression type. 228 LSL_Type type; // Expression type.
229#if LUASL_DIFF_CHECK
230 Eina_Strbuf *ignorableText;
231#endif
229/* 232/*
230LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *left, LSL_Leaf *expr, LSL_Leaf *right, LSL_Leaf *block); 233LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *left, LSL_Leaf *expr, LSL_Leaf *right, LSL_Leaf *block);
231 234
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index 09463a9..604a5a8 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -746,7 +746,11 @@ LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Type type,
746 } 746 }
747 747
748 if (lval) 748 if (lval)
749 {
750 stat->ignorableText = lval->ignorableText;
751 lval->ignorableText = NULL;
749 lval->value.statementValue = stat; 752 lval->value.statementValue = stat;
753 }
750 } 754 }
751 755
752 756
@@ -756,13 +760,11 @@ LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Type type,
756LSL_Leaf *collectStatements(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *statement) 760LSL_Leaf *collectStatements(LuaSL_compiler *compiler, LSL_Leaf *list, LSL_Leaf *statement)
757{ 761{
758 boolean wasNull = FALSE; 762 boolean wasNull = FALSE;
763
759 if (NULL == list) 764 if (NULL == list)
760 { 765 {
761 list = newLeaf(LSL_BLOCK_OPEN, NULL, NULL); 766 list = newLeaf(LSL_BLOCK_OPEN, NULL, NULL);
762 if (list) 767 wasNull = TRUE;
763 {
764 wasNull = TRUE;
765 }
766 } 768 }
767 769
768 if (list) 770 if (list)
@@ -1356,6 +1358,11 @@ static void outputRawStatement(FILE *file, outputMode mode, LSL_Statement *state
1356 if (statement->block) 1358 if (statement->block)
1357 outputRawBlock(file, mode, statement->block); 1359 outputRawBlock(file, mode, statement->block);
1358 1360
1361#if LUASL_DIFF_CHECK
1362 if (statement->ignorableText)
1363 fwrite(eina_strbuf_string_get(statement->ignorableText), 1, eina_strbuf_length_get(statement->ignorableText), file);
1364#endif
1365
1359 if (!isBlock) 1366 if (!isBlock)
1360 { 1367 {
1361 fprintf(file, ";"); 1368 fprintf(file, ";");
@@ -1474,13 +1481,7 @@ static void outputStateToken(FILE *file, outputMode mode, LSL_Leaf *content)
1474static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content) 1481static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content)
1475{ 1482{
1476 if (content) 1483 if (content)
1477 {
1478 outputRawStatement(file, mode, content->value.statementValue); 1484 outputRawStatement(file, mode, content->value.statementValue);
1479#if LUASL_DIFF_CHECK
1480 if (content->ignorableText)
1481 fwrite(eina_strbuf_string_get(content->ignorableText), 1, eina_strbuf_length_get(content->ignorableText), file);
1482#endif
1483 }
1484} 1485}
1485 1486
1486static void outputBlockToken(FILE *file, outputMode mode, LSL_Leaf *content) 1487static void outputBlockToken(FILE *file, outputMode mode, LSL_Leaf *content)