aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src
diff options
context:
space:
mode:
Diffstat (limited to 'LuaSL/src')
-rw-r--r--LuaSL/src/LuaSL_compile.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index 1b3063c..ea68a2a 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -1740,9 +1740,19 @@ static void outputRawStatement(FILE *file, outputMode mode, LSL_Statement *state
1740 if ((statement->ignorable) && (statement->ignorable[1])) 1740 if ((statement->ignorable) && (statement->ignorable[1]))
1741 fwrite(eina_strbuf_string_get(statement->ignorable[1]), 1, eina_strbuf_length_get(statement->ignorable[1]), file); 1741 fwrite(eina_strbuf_string_get(statement->ignorable[1]), 1, eina_strbuf_length_get(statement->ignorable[1]), file);
1742#endif 1742#endif
1743 fprintf(file, "%s", tokens[statement->type - lowestToken]->toKen); 1743 if (OM_LSL == mode)
1744 if (statement->identifier.text) 1744 {
1745 outputText(file, &(statement->identifier), TRUE); 1745 fprintf(file, "%s", tokens[statement->type - lowestToken]->toKen);
1746 if (statement->identifier.text)
1747 outputText(file, &(statement->identifier), TRUE);
1748 }
1749 else if (OM_LUA == mode)
1750 {
1751 fprintf(file, "stateChange(");
1752 if (statement->identifier.text)
1753 outputText(file, &(statement->identifier), TRUE);
1754 fprintf(file, ")");
1755 }
1746 break; 1756 break;
1747 } 1757 }
1748 case LSL_STATEMENT : 1758 case LSL_STATEMENT :
@@ -2131,8 +2141,18 @@ static void outputStateToken(FILE *file, outputMode mode, LSL_Leaf *content)
2131 2141
2132 if (state) 2142 if (state)
2133 { 2143 {
2134 outputText(file, &(state->state), !(LSL_NOIGNORE & content->toKen->flags)); 2144 if (OM_LSL == mode)
2135 outputText(file, &(state->name), !(LSL_NOIGNORE & content->toKen->flags)); 2145 {
2146 outputText(file, &(state->state), !(LSL_NOIGNORE & content->toKen->flags));
2147 outputText(file, &(state->name), !(LSL_NOIGNORE & content->toKen->flags));
2148 outputRawBlock(file, mode, state->block, TRUE);
2149 }
2150 else if (OM_LUA == mode)
2151 {
2152 fprintf(file, "\n\n--[[state]] ");
2153 outputText(file, &(state->name), !(LSL_NOIGNORE & content->toKen->flags));
2154 fprintf(file, " = nil;");
2155 }
2136 outputRawBlock(file, mode, state->block, TRUE); 2156 outputRawBlock(file, mode, state->block, TRUE);
2137 } 2157 }
2138 } 2158 }
@@ -2201,6 +2221,7 @@ static boolean doneParsing(LuaSL_compiler *compiler)
2201 fprintf(out, "function preIncrement(x) x = x + 1; return x; end;\n"); 2221 fprintf(out, "function preIncrement(x) x = x + 1; return x; end;\n");
2202 fprintf(out, "function postDecrement(x) x = x - 1; return x; end;\n"); 2222 fprintf(out, "function postDecrement(x) x = x - 1; return x; end;\n");
2203 fprintf(out, "function postIncrement(x) x = x + 1; return x; end;\n"); 2223 fprintf(out, "function postIncrement(x) x = x + 1; return x; end;\n");
2224 fprintf(out, "function stateChange(x) end;\n");
2204 fprintf(out, "--// Generated code goes here.\n\n"); 2225 fprintf(out, "--// Generated code goes here.\n\n");
2205 outputLeaf(out, OM_LUA, compiler->ast); 2226 outputLeaf(out, OM_LUA, compiler->ast);
2206 fclose(out); 2227 fclose(out);