aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-31 13:01:24 +1000
committerDavid Walter Seikel2012-01-31 13:01:24 +1000
commit8ca98d77a10adfc26d2038655dcb0acd4712ca62 (patch)
tree34a50bda7cd2d23e6e28c40e7a7b00142302fc32
parentStatements now have an ignorable array. (diff)
downloadSledjHamr-8ca98d77a10adfc26d2038655dcb0acd4712ca62.zip
SledjHamr-8ca98d77a10adfc26d2038655dcb0acd4712ca62.tar.gz
SledjHamr-8ca98d77a10adfc26d2038655dcb0acd4712ca62.tar.bz2
SledjHamr-8ca98d77a10adfc26d2038655dcb0acd4712ca62.tar.xz
ignorableText -> ignorable coz it's neater. lol
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h12
-rw-r--r--LuaSL/src/LuaSL_compile.c57
-rw-r--r--LuaSL/src/LuaSL_lexer.l6
3 files changed, 38 insertions, 37 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 18a4d81..931537c 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -165,7 +165,7 @@ struct _LSL_Text
165{ 165{
166 const char *text; 166 const char *text;
167#if LUASL_DIFF_CHECK 167#if LUASL_DIFF_CHECK
168 Eina_Strbuf *ignorableText; 168 Eina_Strbuf *ignorable;
169#endif 169#endif
170}; 170};
171 171
@@ -175,7 +175,7 @@ struct _LSL_Leaf
175 LSL_Leaf *right; 175 LSL_Leaf *right;
176 LSL_Token *toKen; 176 LSL_Token *toKen;
177#if LUASL_DIFF_CHECK 177#if LUASL_DIFF_CHECK
178 Eina_Strbuf *ignorableText; 178 Eina_Strbuf *ignorable;
179#endif 179#endif
180 int line, column, len; 180 int line, column, len;
181 opType basicType; 181 opType basicType;
@@ -203,7 +203,7 @@ struct _LSL_Parenthesis
203{ 203{
204 LSL_Leaf *contents; 204 LSL_Leaf *contents;
205#if LUASL_DIFF_CHECK 205#if LUASL_DIFF_CHECK
206 Eina_Strbuf *rightIgnorableText; 206 Eina_Strbuf *rightIgnorable;
207#endif 207#endif
208 LSL_Type type; 208 LSL_Type type;
209}; 209};
@@ -251,8 +251,8 @@ struct _LSL_Block
251 Eina_Hash *variables; // Those variables in this scope. 251 Eina_Hash *variables; // Those variables in this scope.
252 LSL_Function *function; // A pointer to the function if this block is a function. 252 LSL_Function *function; // A pointer to the function if this block is a function.
253#if LUASL_DIFF_CHECK 253#if LUASL_DIFF_CHECK
254 Eina_Strbuf *openIgnorableText; 254 Eina_Strbuf *openIgnorable;
255 Eina_Strbuf *closeIgnorableText; 255 Eina_Strbuf *closeIgnorable;
256#endif 256#endif
257}; 257};
258 258
@@ -370,7 +370,7 @@ typedef struct
370 LSL_Leaf *ast; 370 LSL_Leaf *ast;
371 LSL_Script script; 371 LSL_Script script;
372#if LUASL_DIFF_CHECK 372#if LUASL_DIFF_CHECK
373 Eina_Strbuf *ignorableText; 373 Eina_Strbuf *ignorable;
374#endif 374#endif
375 LSL_Leaf *lval; 375 LSL_Leaf *lval;
376 LSL_Block *currentBlock; 376 LSL_Block *currentBlock;
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);
diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l
index 0c7d627..4329bb2 100644
--- a/LuaSL/src/LuaSL_lexer.l
+++ b/LuaSL/src/LuaSL_lexer.l
@@ -139,11 +139,11 @@ int common(YYSTYPE *lval, char *text, int len, LuaSL_compiler *compiler, boolean
139#if LUASL_DIFF_CHECK 139#if LUASL_DIFF_CHECK
140 if (checkIgnorable) 140 if (checkIgnorable)
141 { 141 {
142 lval->ignorableText = compiler->ignorableText; 142 lval->ignorable = compiler->ignorable;
143 compiler->ignorableText = eina_strbuf_new(); 143 compiler->ignorable = eina_strbuf_new();
144 } 144 }
145 else 145 else
146 eina_strbuf_append_length(compiler->ignorableText, text, len); 146 eina_strbuf_append_length(compiler->ignorable, text, len);
147#endif 147#endif
148 148
149 return type; 149 return type;