aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/LuaSL/LuaSL_LSL_tree.h3
-rw-r--r--src/LuaSL/LuaSL_compile.c13
-rw-r--r--src/LuaSL/LuaSL_lemon_yaccer.y12
-rw-r--r--src/LuaSL/LuaSL_lexer.l2
-rw-r--r--src/LuaSL/LuaSL_main.c2
-rw-r--r--src/libraries/Runnr.c8
6 files changed, 26 insertions, 14 deletions
diff --git a/src/LuaSL/LuaSL_LSL_tree.h b/src/LuaSL/LuaSL_LSL_tree.h
index 4192310..98e8e22 100644
--- a/src/LuaSL/LuaSL_LSL_tree.h
+++ b/src/LuaSL/LuaSL_LSL_tree.h
@@ -3,7 +3,8 @@
3#define __LUASL_TREE_H__ 3#define __LUASL_TREE_H__
4 4
5#define LUASL_DEBUG 0 5#define LUASL_DEBUG 0
6#define COMPILE_THREADED 0 6#define COMPILE_THREADED 1
7#define COMPILE_OUTPUT 0
7#define LUASL_DIFF_CHECK 0 8#define LUASL_DIFF_CHECK 0
8#define LUASL_BAD_CHECK 1 9#define LUASL_BAD_CHECK 1
9 10
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c
index 4764855..a2b2bca 100644
--- a/src/LuaSL/LuaSL_compile.c
+++ b/src/LuaSL/LuaSL_compile.c
@@ -501,7 +501,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
501 // someList = someList + notAList -> someList = _LSL.listAddList( someList, notAList) 501 // someList = someList + notAList -> someList = _LSL.listAddList( someList, notAList)
502 else if ((OT_list == lType) || (OT_list == rType)) 502 else if ((OT_list == lType) || (OT_list == rType))
503 { 503 {
504 504#if COMPILE_OUTPUT
505if ((left) && (right)) 505if ((left) && (right))
506 printf("LA LINE %d - %s %s %s\n", lval->line, left->toKen->toKen, lval->toKen->toKen, right->toKen->toKen); 506 printf("LA LINE %d - %s %s %s\n", lval->line, left->toKen->toKen, lval->toKen->toKen, right->toKen->toKen);
507else if (left) 507else if (left)
@@ -510,7 +510,7 @@ else if (right)
510 printf("LA LINE %d - NOLEFT %s %s\n", lval->line, lval->toKen->toKen, right->toKen->toKen); 510 printf("LA LINE %d - NOLEFT %s %s\n", lval->line, lval->toKen->toKen, right->toKen->toKen);
511else 511else
512 printf("LA LINE %d - NOLEFT %s NORIGHT\n", lval->line, lval->toKen->toKen); 512 printf("LA LINE %d - NOLEFT %s NORIGHT\n", lval->line, lval->toKen->toKen);
513 513#endif
514 lval->basicType = OT_list; 514 lval->basicType = OT_list;
515 lval->toKen = tokens[LSL_LIST_ADD_LIST - lowestToken]; 515 lval->toKen = tokens[LSL_LIST_ADD_LIST - lowestToken];
516 } 516 }
@@ -575,6 +575,7 @@ else
575 { 575 {
576 if (left->flags & MF_ASSIGNEXP) 576 if (left->flags & MF_ASSIGNEXP)
577 { 577 {
578#if COMPILE_OUTPUT
578if ((left) && (right)) 579if ((left) && (right))
579 printf("%s %s %s\n", left->toKen->toKen, lval->toKen->toKen, right->toKen->toKen); 580 printf("%s %s %s\n", left->toKen->toKen, lval->toKen->toKen, right->toKen->toKen);
580else if (left) 581else if (left)
@@ -584,6 +585,7 @@ else if (right)
584else 585else
585 printf("NOLEFT %s NORIGHT\n", lval->toKen->toKen); 586 printf("NOLEFT %s NORIGHT\n", lval->toKen->toKen);
586 printf("############################################################################## left\n"); 587 printf("############################################################################## left\n");
588#endif
587 left->flags |= MF_WRAPFUNC; 589 left->flags |= MF_WRAPFUNC;
588 if (LSL_PARENTHESIS_OPEN == left->toKen->type) 590 if (LSL_PARENTHESIS_OPEN == left->toKen->type)
589 left->value.parenthesis->flags |= MF_WRAPFUNC; 591 left->value.parenthesis->flags |= MF_WRAPFUNC;
@@ -609,6 +611,7 @@ else
609 { 611 {
610 if (right->flags & MF_ASSIGNEXP) 612 if (right->flags & MF_ASSIGNEXP)
611 { 613 {
614#if COMPILE_OUTPUT
612if ((left) && (right)) 615if ((left) && (right))
613 printf("%s %s %s\n", left->toKen->toKen, lval->toKen->toKen, right->toKen->toKen); 616 printf("%s %s %s\n", left->toKen->toKen, lval->toKen->toKen, right->toKen->toKen);
614else if (left) 617else if (left)
@@ -618,6 +621,7 @@ else if (right)
618else 621else
619 printf("NOLEFT %s NORIGHT\n", lval->toKen->toKen); 622 printf("NOLEFT %s NORIGHT\n", lval->toKen->toKen);
620 printf("############################################################################## right\n"); 623 printf("############################################################################## right\n");
624#endif
621 right->flags |= MF_WRAPFUNC; 625 right->flags |= MF_WRAPFUNC;
622 } 626 }
623 } 627 }
@@ -643,8 +647,6 @@ else
643 rightType = allowed[right->basicType].name; 647 rightType = allowed[right->basicType].name;
644 } 648 }
645 649
646// compiler->compiler->bugCount++;
647// sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerError(%d,%d,Invalid operation [%s(%s) %s %s(%s)])", lval->line, lval->column, leftType, leftToken, lval->toKen->toKen, rightType, rightToken);
648 finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage), 650 finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage),
649 "Invalid operation [%s(%s) %s %s(%s)]", leftType, leftToken, lval->toKen->toKen, rightType, rightToken), 651 "Invalid operation [%s(%s) %s %s(%s)]", leftType, leftToken, lval->toKen->toKen, rightType, rightToken),
650 1, lval->column, lval->line); 652 1, lval->column, lval->line);
@@ -1429,6 +1431,7 @@ static void outputLeaf(FILE *file, outputMode mode, LSL_Leaf *leaf)
1429 if (MF_WRAPFUNC & leaf->flags) 1431 if (MF_WRAPFUNC & leaf->flags)
1430 { 1432 {
1431// TODO - Leaving this here in case we trip over one. 1433// TODO - Leaving this here in case we trip over one.
1434#if COMPILE_OUTPUT
1432if ((leaf->left) && (leaf->right)) 1435if ((leaf->left) && (leaf->right))
1433 printf("%s %s %s\n", leaf->left->toKen->toKen, leaf->toKen->toKen, leaf->right->toKen->toKen); 1436 printf("%s %s %s\n", leaf->left->toKen->toKen, leaf->toKen->toKen, leaf->right->toKen->toKen);
1434else if (leaf->left) 1437else if (leaf->left)
@@ -1437,6 +1440,7 @@ else if (leaf->right)
1437 printf("NOLEFT %s %s\n", leaf->toKen->toKen, leaf->right->toKen->toKen); 1440 printf("NOLEFT %s %s\n", leaf->toKen->toKen, leaf->right->toKen->toKen);
1438else 1441else
1439 printf("NOLEFT %s NORIGHT\n", leaf->toKen->toKen); 1442 printf("NOLEFT %s NORIGHT\n", leaf->toKen->toKen);
1443#endif
1440 } 1444 }
1441 if ((LSL_ASSIGNMENT & leaf->toKen->flags) && (LSL_ASSIGNMENT_PLAIN != leaf->toKen->type)) 1445 if ((LSL_ASSIGNMENT & leaf->toKen->flags) && (LSL_ASSIGNMENT_PLAIN != leaf->toKen->type))
1442 { 1446 {
@@ -2315,7 +2319,6 @@ void compileLSL(LuaCompiler *compiler)
2315 } 2319 }
2316 else 2320 else
2317 { 2321 {
2318// sendBack(lcompiler->compiler->client, lcompiler->compiler->SID, "compilerError(%d,%d,NOT FOUND function %s called)", call->call->line, call->call->column, call->call->value.stringValue);
2319 finishMessage(lcompiler->compiler, addMessage(&(lcompiler->compiler->messages), sizeof(compileMessage), 2322 finishMessage(lcompiler->compiler, addMessage(&(lcompiler->compiler->messages), sizeof(compileMessage),
2320 "NOT FOUND function %s called", call->call->value.stringValue), 2323 "NOT FOUND function %s called", call->call->value.stringValue),
2321 1, call->call->column, call->call->line); 2324 1, call->call->column, call->call->line);
diff --git a/src/LuaSL/LuaSL_lemon_yaccer.y b/src/LuaSL/LuaSL_lemon_yaccer.y
index 08fdccc..5ddf45a 100644
--- a/src/LuaSL/LuaSL_lemon_yaccer.y
+++ b/src/LuaSL/LuaSL_lemon_yaccer.y
@@ -229,20 +229,20 @@ expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; }
229 229
230%parse_failure 230%parse_failure
231{ 231{
232 compiler->compiler->bugCount++; 232 finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage),
233 PE("Giving up. Parser is hopelessly lost!"); 233 "Giving up. Parser is hopelessly lost!"),
234 1, -1, -1);
234} 235}
235 236
236%stack_overflow 237%stack_overflow
237{ 238{
238 compiler->compiler->bugCount++; 239 finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage),
239 PE("Giving up. Parser stack overflow @ line %d, column %d!", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens. 240 "Giving up. Parser stack overflow"), // Gotta love consistancy, if it ever happens.
241 1, yypMinor->yy0->column, yypMinor->yy0->line);
240} 242}
241 243
242%syntax_error 244%syntax_error
243{ 245{
244// compiler->compiler->bugCount++;
245// PE("Syntax error @ line %d, column %d!", yyminor.yy0->line, yyminor.yy0->column);
246 finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage), 246 finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage),
247 "Syntax error."), 247 "Syntax error."),
248 1, yyminor.yy0->column, yyminor.yy0->line); 248 1, yyminor.yy0->column, yyminor.yy0->line);
diff --git a/src/LuaSL/LuaSL_lexer.l b/src/LuaSL/LuaSL_lexer.l
index 85b2821..9d58899 100644
--- a/src/LuaSL/LuaSL_lexer.l
+++ b/src/LuaSL/LuaSL_lexer.l
@@ -113,7 +113,7 @@ STRING \"(\\.|[^\\"\n])*\"
113<<EOF>> { return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_SCRIPT); } 113<<EOF>> { return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_SCRIPT); }
114 114
115 /* Everything else */ 115 /* Everything else */
116. %{ printf(" unexpected character.\n"); yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); common(yylval, yytext, yyleng, yyextra, TRUE, LSL_UNKNOWN); %} 116. %{ if (COMPILE_OUTPUT) printf(" unexpected character '%s'.\n", yytext); yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); common(yylval, yytext, yyleng, yyextra, TRUE, LSL_UNKNOWN); %}
117 117
118%% 118%%
119 119
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index 1eaa43a..0ffc679 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -186,10 +186,12 @@ static void _compileCb(LuaCompiler *compiler)
186 186
187 EINA_CLIST_FOR_EACH_ENTRY_SAFE(message, safe, &(compiler->messages), compileMessage, node) 187 EINA_CLIST_FOR_EACH_ENTRY_SAFE(message, safe, &(compiler->messages), compileMessage, node)
188 { 188 {
189#if COMPILE_OUTPUT
189 if (message->type) 190 if (message->type)
190 sendBack(compiler->client, compiler->SID, "compilerError(%d,%d,%s)", message->line, message->column, message->message); 191 sendBack(compiler->client, compiler->SID, "compilerError(%d,%d,%s)", message->line, message->column, message->message);
191 else 192 else
192 sendBack(compiler->client, compiler->SID, "compilerWarning(%d,%d,%s)", message->line, message->column, message->message); 193 sendBack(compiler->client, compiler->SID, "compilerWarning(%d,%d,%s)", message->line, message->column, message->message);
194#endif
193 eina_clist_remove(&(message->node)); 195 eina_clist_remove(&(message->node));
194 free(message); 196 free(message);
195 } 197 }
diff --git a/src/libraries/Runnr.c b/src/libraries/Runnr.c
index 5fecfdf..fbd4289 100644
--- a/src/libraries/Runnr.c
+++ b/src/libraries/Runnr.c
@@ -442,12 +442,14 @@ static void _compileThread(void *data, Ecore_Thread *thread)
442 if (err) 442 if (err)
443 { 443 {
444 compiler->bugCount++; 444 compiler->bugCount++;
445#if COMPILE_OUTPUT
445 if (LUA_ERRSYNTAX == err) 446 if (LUA_ERRSYNTAX == err)
446 printf("Lua syntax error in %s: %s\n", name, lua_tostring(L, -1)); 447 printf("Lua syntax error in %s: %s\n", name, lua_tostring(L, -1));
447 else if (LUA_ERRFILE == err) 448 else if (LUA_ERRFILE == err)
448 printf("Lua compile file error in %s: %s\n", name, lua_tostring(L, -1)); 449 printf("Lua compile file error in %s: %s\n", name, lua_tostring(L, -1));
449 else if (LUA_ERRMEM == err) 450 else if (LUA_ERRMEM == err)
450 printf("Lua compile memory allocation error in %s: %s\n", name, lua_tostring(L, -1)); 451 printf("Lua compile memory allocation error in %s: %s\n", name, lua_tostring(L, -1));
452#endif
451 } 453 }
452 else 454 else
453 { 455 {
@@ -480,11 +482,15 @@ static void _compileThread(void *data, Ecore_Thread *thread)
480 else 482 else
481 { 483 {
482 compiler->bugCount++; 484 compiler->bugCount++;
485#if COMPILE_OUTPUT
483 printf("Nothing for Lua to compile!\n"); 486 printf("Nothing for Lua to compile!\n");
487#endif
484 } 488 }
485} 489}
486 490
487// TODO - Threaded version is consistantly about half the speed. WTF? 491// Speed tests scripts per second - Threaded Unthreaded
492// 900 - 1400 750 - 800
493// But with outputting to the console - 450 - 700 750 - 800
488void compileScript(LuaCompiler *compiler, int threadIt) 494void compileScript(LuaCompiler *compiler, int threadIt)
489{ 495{
490 if (threadIt) 496 if (threadIt)