diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 9ebda0f..277e278 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -203,7 +203,7 @@ void burnLeaf(LSL_Leaf *leaf) | |||
203 | burnLeaf(leaf->left); | 203 | burnLeaf(leaf->left); |
204 | burnLeaf(leaf->right); | 204 | burnLeaf(leaf->right); |
205 | // TODO - Should free up the value to. | 205 | // TODO - Should free up the value to. |
206 | free(leaf->ignorableText); | 206 | eina_strbuf_free(leaf->ignorableText); |
207 | free(leaf); | 207 | free(leaf); |
208 | } | 208 | } |
209 | } | 209 | } |
@@ -447,9 +447,9 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
447 | } | 447 | } |
448 | if (compiler->currentBlock) | 448 | if (compiler->currentBlock) |
449 | { | 449 | { |
450 | compiler->currentBlock->vcount++; | 450 | // compiler->currentBlock->vcount++; |
451 | compiler->currentBlock->variables = realloc(compiler->currentBlock->variables, compiler->currentBlock->vcount * sizeof(LSL_Identifier *)); | 451 | // compiler->currentBlock->variables = realloc(compiler->currentBlock->variables, compiler->currentBlock->vcount * sizeof(LSL_Identifier *)); |
452 | compiler->currentBlock->variables[compiler->currentBlock->vcount - 1] = result; | 452 | // compiler->currentBlock->variables[compiler->currentBlock->vcount - 1] = result; |
453 | } | 453 | } |
454 | else | 454 | else |
455 | { | 455 | { |
@@ -784,7 +784,7 @@ static void outputLeaf(FILE *file, outputMode mode, LSL_Leaf *leaf) | |||
784 | { | 784 | { |
785 | outputLeaf(file, mode, leaf->left); | 785 | outputLeaf(file, mode, leaf->left); |
786 | if ((!(LSL_NOIGNORE & leaf->token->flags)) && (leaf->ignorableText)) | 786 | if ((!(LSL_NOIGNORE & leaf->token->flags)) && (leaf->ignorableText)) |
787 | fprintf(file, "%s", leaf->ignorableText); | 787 | fwrite(eina_strbuf_string_get(leaf->ignorableText), 1, eina_strbuf_length_get(leaf->ignorableText), file); |
788 | if (leaf->token->output) | 788 | if (leaf->token->output) |
789 | leaf->token->output(file, mode, leaf); | 789 | leaf->token->output(file, mode, leaf); |
790 | else | 790 | else |
@@ -857,7 +857,7 @@ static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content) | |||
857 | { | 857 | { |
858 | outputLeaf(file, mode, content->value.statementValue->expressions); | 858 | outputLeaf(file, mode, content->value.statementValue->expressions); |
859 | if (content->ignorableText) | 859 | if (content->ignorableText) |
860 | fprintf(file, "%s", content->ignorableText); | 860 | fwrite(eina_strbuf_string_get(content->ignorableText), 1, eina_strbuf_length_get(content->ignorableText), file); |
861 | fprintf(file, "%s", content->token->token); | 861 | fprintf(file, "%s", content->token->token); |
862 | } | 862 | } |
863 | } | 863 | } |
@@ -947,6 +947,7 @@ Eina_Bool compileLSL(gameGlobals *game, char *script) | |||
947 | 947 | ||
948 | memset(&compiler, 0, sizeof(LuaSL_compiler)); | 948 | memset(&compiler, 0, sizeof(LuaSL_compiler)); |
949 | compiler.game = game; | 949 | compiler.game = game; |
950 | compiler.ignorableText = eina_strbuf_new(); | ||
950 | 951 | ||
951 | strncpy(compiler.fileName, script, PATH_MAX - 1); | 952 | strncpy(compiler.fileName, script, PATH_MAX - 1); |
952 | compiler.fileName[PATH_MAX - 1] = '\0'; | 953 | compiler.fileName[PATH_MAX - 1] = '\0'; |