diff options
Diffstat (limited to 'src/LuaSL/LuaSL_compile.c')
-rw-r--r-- | src/LuaSL/LuaSL_compile.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c index d1ef48b..b2ae841 100644 --- a/src/LuaSL/LuaSL_compile.c +++ b/src/LuaSL/LuaSL_compile.c | |||
@@ -223,6 +223,15 @@ LSL_Script constants; | |||
223 | int lowestToken = 999999; | 223 | int lowestToken = 999999; |
224 | 224 | ||
225 | 225 | ||
226 | static void finishMessage(LuaCompile *compiler, compileMessage *message, int type, int column, int line) | ||
227 | { | ||
228 | message->type = type; | ||
229 | message->column = column; | ||
230 | message->line = line; | ||
231 | if (type) | ||
232 | compiler->bugCount++; | ||
233 | } | ||
234 | |||
226 | static LSL_Leaf *newLeaf(LSL_Type type, LSL_Leaf *left, LSL_Leaf *right) | 235 | static LSL_Leaf *newLeaf(LSL_Type type, LSL_Leaf *left, LSL_Leaf *right) |
227 | { | 236 | { |
228 | LSL_Leaf *leaf = calloc(1, sizeof(LSL_Leaf)); | 237 | LSL_Leaf *leaf = calloc(1, sizeof(LSL_Leaf)); |
@@ -361,8 +370,11 @@ LSL_Leaf *checkVariable(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf | |||
361 | } | 370 | } |
362 | else | 371 | else |
363 | { | 372 | { |
364 | compiler->compiler->bugCount++; | 373 | // compiler->compiler->bugCount++; |
365 | sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerError(%d,%d,NOT FOUND variable %s)", identifier->line, identifier->column, identifier->value.stringValue); | 374 | // sendBack(compiler->compiler->client, compiler->compiler->SID, "compilerError(%d,%d,NOT FOUND variable %s)", identifier->line, identifier->column, identifier->value.stringValue); |
375 | finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage), | ||
376 | "NOT FOUND variable %s", identifier->value.stringValue), | ||
377 | 1, identifier->column, identifier->line); | ||
366 | } | 378 | } |
367 | } | 379 | } |
368 | 380 | ||
@@ -632,8 +644,11 @@ else | |||
632 | rightType = allowed[right->basicType].name; | 644 | rightType = allowed[right->basicType].name; |
633 | } | 645 | } |
634 | 646 | ||
635 | compiler->compiler->bugCount++; | 647 | // compiler->compiler->bugCount++; |
636 | 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 | // 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); |
649 | finishMessage(compiler->compiler, addMessage(&(compiler->compiler->messages), sizeof(compileMessage), | ||
650 | "Invalid operation [%s(%s) %s %s(%s)]", leftType, leftToken, lval->toKen->toKen, rightType, rightToken), | ||
651 | 1, lval->column, lval->line); | ||
637 | } | 652 | } |
638 | } | 653 | } |
639 | 654 | ||
@@ -2234,7 +2249,7 @@ void compileLSL(LuaCompiler *compiler) | |||
2234 | lcompiler->ignorable = eina_strbuf_new(); | 2249 | lcompiler->ignorable = eina_strbuf_new(); |
2235 | #endif | 2250 | #endif |
2236 | 2251 | ||
2237 | PI("Compiling %s.", lcompiler->compiler->file); | 2252 | // PI("Compiling %s.", lcompiler->compiler->file); |
2238 | 2253 | ||
2239 | in = fopen(lcompiler->compiler->file, "r"); | 2254 | in = fopen(lcompiler->compiler->file, "r"); |
2240 | if (NULL == in) | 2255 | if (NULL == in) |
@@ -2300,7 +2315,12 @@ void compileLSL(LuaCompiler *compiler) | |||
2300 | call->call->basicType = func->basicType; | 2315 | call->call->basicType = func->basicType; |
2301 | } | 2316 | } |
2302 | else | 2317 | else |
2303 | 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); | 2318 | { |
2319 | // 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); | ||
2320 | finishMessage(lcompiler->compiler, addMessage(&(lcompiler->compiler->messages), sizeof(compileMessage), | ||
2321 | "NOT FOUND function %s called)", call->call->value.stringValue), | ||
2322 | 1, call->call->column, call->call->line); | ||
2323 | } | ||
2304 | } | 2324 | } |
2305 | } | 2325 | } |
2306 | secondPass(lcompiler, lcompiler->ast); | 2326 | secondPass(lcompiler, lcompiler->ast); |