aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-02 14:05:15 +1000
committerDavid Walter Seikel2012-02-02 14:05:15 +1000
commite057040a77f31971b903685b4e95254e898b7fad (patch)
tree8b5c6d6c8688ffae836fe23f3c582b43f3a55cb1 /LuaSL/src
parentZaro boogs! B-) (diff)
downloadSledjHamr-e057040a77f31971b903685b4e95254e898b7fad.zip
SledjHamr-e057040a77f31971b903685b4e95254e898b7fad.tar.gz
SledjHamr-e057040a77f31971b903685b4e95254e898b7fad.tar.bz2
SledjHamr-e057040a77f31971b903685b4e95254e898b7fad.tar.xz
Disable the diff check again, and count bugs instead.
Diffstat (limited to 'LuaSL/src')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h1
-rw-r--r--LuaSL/src/LuaSL_compile.c32
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y3
3 files changed, 29 insertions, 7 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index ca91ff0..00094b1 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -310,6 +310,7 @@ struct _LSL_Script
310 Eina_Hash *functions; 310 Eina_Hash *functions;
311 Eina_Hash *states; 311 Eina_Hash *states;
312 Eina_Hash *variables; 312 Eina_Hash *variables;
313 int bugCount, warningCount;
313}; 314};
314 315
315/* Tracking variables. 316/* Tracking variables.
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index d32a44f..a63c6ca 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -341,8 +341,11 @@ LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf
341 } 341 }
342 } 342 }
343 } 343 }
344 else 344 else
345 {
346 compiler->script.bugCount++;
345 PE("NOT found %s @ line %d, column %d!", identifier->value.stringValue, identifier->line, identifier->column); 347 PE("NOT found %s @ line %d, column %d!", identifier->value.stringValue, identifier->line, identifier->column);
348 }
346 } 349 }
347 350
348 return identifier; 351 return identifier;
@@ -384,6 +387,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
384 lType = left->basicType; 387 lType = left->basicType;
385 if (OT_undeclared == lType) 388 if (OT_undeclared == lType)
386 { 389 {
390 compiler->script.warningCount++;
387 PW("Undeclared identifier issue, deferring this until the second pass. @ line %d, column %d.", lval->line, lval->column); 391 PW("Undeclared identifier issue, deferring this until the second pass. @ line %d, column %d.", lval->line, lval->column);
388 lval->basicType = OT_undeclared; 392 lval->basicType = OT_undeclared;
389 return lval; 393 return lval;
@@ -411,6 +415,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
411 rType = right->basicType; 415 rType = right->basicType;
412 if (OT_undeclared == rType) 416 if (OT_undeclared == rType)
413 { 417 {
418 compiler->script.warningCount++;
414 PW("Undeclared identifier issue, deferring this until the second pass. @ line %d, column %d.", lval->line, lval->column); 419 PW("Undeclared identifier issue, deferring this until the second pass. @ line %d, column %d.", lval->line, lval->column);
415 lval->basicType = OT_undeclared; 420 lval->basicType = OT_undeclared;
416 return lval; 421 return lval;
@@ -479,6 +484,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
479 rightType = allowed[right->basicType].name; 484 rightType = allowed[right->basicType].name;
480 } 485 }
481 486
487 compiler->script.bugCount++;
482 PE("Invalid operation [%s(%s) %s %s(%s)] @ line %d, column %d!", leftType, leftToken, lval->toKen->toKen, rightType, rightToken, lval->line, lval->column); 488 PE("Invalid operation [%s(%s) %s %s(%s)] @ line %d, column %d!", leftType, leftToken, lval->toKen->toKen, rightType, rightToken, lval->line, lval->column);
483 } 489 }
484 } 490 }
@@ -949,6 +955,7 @@ LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow,
949 } 955 }
950 default : 956 default :
951 { 957 {
958 compiler->script.bugCount++;
952 PE("Should not be here %d.", stat->type); 959 PE("Should not be here %d.", stat->type);
953 break; 960 break;
954 } 961 }
@@ -1925,18 +1932,18 @@ static boolean doneParsing(LuaSL_compiler *compiler)
1925 if (out) 1932 if (out)
1926 { 1933 {
1927 char diffName[PATH_MAX]; 1934 char diffName[PATH_MAX];
1928 int count; 1935// int count;
1929 1936
1930 strcpy(diffName, compiler->fileName); 1937 strcpy(diffName, compiler->fileName);
1931 strcat(diffName, ".diff"); 1938 strcat(diffName, ".diff");
1932 outputLeaf(out, OM_LSL, compiler->ast); 1939 outputLeaf(out, OM_LSL, compiler->ast);
1933 fclose(out); 1940 fclose(out);
1934 sprintf(buffer, "diff -u \"%s\" \"%s\" > \"%s\"", compiler->fileName, outName, diffName); 1941 sprintf(buffer, "diff -u \"%s\" \"%s\" > \"%s\"", compiler->fileName, outName, diffName);
1935 count = system(buffer); 1942// count = system(buffer);
1936 if (0 != count) 1943// if (0 != count)
1937 PE("LSL output file is different - %s!", outName); 1944// PE("LSL output file is different - %s!", outName);
1938 else 1945// else
1939 result = TRUE; 1946// result = TRUE;
1940 } 1947 }
1941 else 1948 else
1942 PC("Unable to open file %s for writing!", outName); 1949 PC("Unable to open file %s for writing!", outName);
@@ -1953,6 +1960,17 @@ static boolean doneParsing(LuaSL_compiler *compiler)
1953 PC("Unable to open file %s for writing!", luaName); 1960 PC("Unable to open file %s for writing!", luaName);
1954 } 1961 }
1955 1962
1963 if (compiler->script.bugCount)
1964 PE("%d errors and %d warnings in %s", compiler->script.bugCount, compiler->script.warningCount, compiler->fileName);
1965 else
1966 {
1967 if (compiler->script.warningCount)
1968 PW("%d errors and %d warnings in %s", compiler->script.bugCount, compiler->script.warningCount, compiler->fileName);
1969 else
1970 PI("%d errors and %d warnings in %s", compiler->script.bugCount, compiler->script.warningCount, compiler->fileName);
1971 result = TRUE;
1972 }
1973
1956 return result; 1974 return result;
1957} 1975}
1958 1976
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index c225b26..9199699 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -223,6 +223,7 @@ expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; }
223{ 223{
224 gameGlobals *game = compiler->game; 224 gameGlobals *game = compiler->game;
225 225
226 compiler->script.bugCount++;
226 PE("Giving up. Parser is hopelessly lost!"); 227 PE("Giving up. Parser is hopelessly lost!");
227} 228}
228 229
@@ -230,6 +231,7 @@ expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; }
230{ 231{
231 gameGlobals *game = compiler->game; 232 gameGlobals *game = compiler->game;
232 233
234 compiler->script.bugCount++;
233 PE("Giving up. Parser stack overflow @ line %d, column %d!", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens. 235 PE("Giving up. Parser stack overflow @ line %d, column %d!", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens.
234} 236}
235 237
@@ -237,6 +239,7 @@ expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; }
237{ 239{
238 gameGlobals *game = compiler->game; 240 gameGlobals *game = compiler->game;
239 241
242 compiler->script.bugCount++;
240 PE("Syntax error @ line %d, column %d!", yyminor.yy0->line, yyminor.yy0->column); 243 PE("Syntax error @ line %d, column %d!", yyminor.yy0->line, yyminor.yy0->column);
241} 244}
242 245