X-Git-Url: http://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/c9914e54f16c3315d47040f4cca2d3788228c504..853c670e4b839fd435507201f04d16080590a894:/src/lexer.c diff --git a/src/lexer.c b/src/lexer.c index f1ce73c..fe904e5 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -1536,9 +1536,8 @@ YY_RULE_SETUP BEGIN(CLASS_CODE); if(++found_classes > 1) { - print_error(FALSE, - "Only one class per file allowed", - line_no); + error_print(GOB_ERROR, line_no, + "Only one class per file allowed"); } return CLASS; @@ -1549,7 +1548,7 @@ case 52: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 345 "lexer.l" +#line 344 "lexer.l" { int maj = 0,min = 0,pl = 0; int rmaj = 0,rmin = 0,rpl = 0; @@ -1562,151 +1561,146 @@ YY_RULE_SETUP if(rmaj < maj || (rmaj == maj && rmin < min) || (rmaj == maj && rmin == min && rpl < pl)) { - char *s; - s = g_strdup_printf( - "GOB version %d.%d.%d required " - "(this is %s)\n" - "To upgrade your gob, see: " - "http://www.5z.com/jirka/gob.html", - maj,min,pl,VERSION); - print_error(FALSE, s, line_no); - g_free(s); + error_printf(GOB_ERROR, line_no, + "GOB version %d.%d.%d required " + "(this is %s)\n" + "To upgrade your gob, see: " + "http://www.5z.com/jirka/gob.html", + maj, min, pl, VERSION); } } YY_BREAK case 53: YY_RULE_SETUP -#line 369 "lexer.l" +#line 365 "lexer.l" { if(for_cpp) { - char *s; - s = g_strdup_printf("'%s' keyword should not " - "be used when generating " - "C++ code", yytext); - print_error(TRUE, s, line_no); - g_free(s); + error_printf(GOB_WARN, line_no, + "'%s' keyword should not " + "be used when generating " + "C++ code", yytext); } REJECT; } YY_BREAK case 54: YY_RULE_SETUP -#line 381 "lexer.l" +#line 375 "lexer.l" {return FROM;} YY_BREAK case 55: YY_RULE_SETUP -#line 383 "lexer.l" +#line 377 "lexer.l" {return VOID;} YY_BREAK case 56: YY_RULE_SETUP -#line 384 "lexer.l" +#line 378 "lexer.l" {return STRUCT;} YY_BREAK case 57: YY_RULE_SETUP -#line 385 "lexer.l" +#line 379 "lexer.l" {return UNION;} YY_BREAK case 58: YY_RULE_SETUP -#line 386 "lexer.l" +#line 380 "lexer.l" {return ENUM;} YY_BREAK case 59: YY_RULE_SETUP -#line 387 "lexer.l" +#line 381 "lexer.l" {return SIGNED;} YY_BREAK case 60: YY_RULE_SETUP -#line 388 "lexer.l" +#line 382 "lexer.l" {return UNSIGNED;} YY_BREAK case 61: YY_RULE_SETUP -#line 389 "lexer.l" +#line 383 "lexer.l" {return LONG;} YY_BREAK case 62: YY_RULE_SETUP -#line 390 "lexer.l" +#line 384 "lexer.l" {return SHORT;} YY_BREAK case 63: YY_RULE_SETUP -#line 391 "lexer.l" +#line 385 "lexer.l" {return INT;} YY_BREAK case 64: YY_RULE_SETUP -#line 392 "lexer.l" +#line 386 "lexer.l" {return FLOAT;} YY_BREAK case 65: YY_RULE_SETUP -#line 393 "lexer.l" +#line 387 "lexer.l" {return DOUBLE;} YY_BREAK case 66: YY_RULE_SETUP -#line 394 "lexer.l" +#line 388 "lexer.l" {return CHAR;} YY_BREAK case 67: YY_RULE_SETUP -#line 395 "lexer.l" +#line 389 "lexer.l" {return CONST;} YY_BREAK case 68: YY_RULE_SETUP -#line 397 "lexer.l" +#line 391 "lexer.l" {return THREEDOTS;} YY_BREAK case 69: YY_RULE_SETUP -#line 399 "lexer.l" +#line 393 "lexer.l" {yylval.line = line_no; return PUBLIC;} YY_BREAK case 70: YY_RULE_SETUP -#line 400 "lexer.l" +#line 394 "lexer.l" {yylval.line = line_no; return PRIVATE;} YY_BREAK case 71: YY_RULE_SETUP -#line 401 "lexer.l" +#line 395 "lexer.l" {yylval.line = line_no; return PROTECTED;} YY_BREAK case 72: YY_RULE_SETUP -#line 402 "lexer.l" +#line 396 "lexer.l" {yylval.line = line_no; return CLASSWIDE;} YY_BREAK case 73: YY_RULE_SETUP -#line 403 "lexer.l" +#line 397 "lexer.l" {yylval.line = line_no; return ARGUMENT;} YY_BREAK case 74: YY_RULE_SETUP -#line 404 "lexer.l" +#line 398 "lexer.l" {yylval.line = line_no; return VIRTUAL;} YY_BREAK case 75: YY_RULE_SETUP -#line 405 "lexer.l" +#line 399 "lexer.l" {yylval.line = line_no; return SIGNAL;} YY_BREAK case 76: YY_RULE_SETUP -#line 406 "lexer.l" +#line 400 "lexer.l" {yylval.line = line_no; return OVERRIDE;} YY_BREAK case 77: YY_RULE_SETUP -#line 407 "lexer.l" +#line 401 "lexer.l" { yylval.id = g_strdup(yytext); return NUMBER; @@ -1714,7 +1708,7 @@ YY_RULE_SETUP YY_BREAK case 78: YY_RULE_SETUP -#line 411 "lexer.l" +#line 405 "lexer.l" { /* this one is for a classname with a namespace */ yylval.id = g_strdup(yytext); @@ -1723,7 +1717,7 @@ YY_RULE_SETUP YY_BREAK case 79: YY_RULE_SETUP -#line 416 "lexer.l" +#line 410 "lexer.l" { /* this is for a classname with an empty namespace */ yylval.id = g_strdup(yytext); @@ -1732,7 +1726,7 @@ YY_RULE_SETUP YY_BREAK case 80: YY_RULE_SETUP -#line 421 "lexer.l" +#line 415 "lexer.l" { yylval.id = g_strdup(yytext); return TOKEN; @@ -1740,7 +1734,7 @@ YY_RULE_SETUP YY_BREAK case 81: YY_RULE_SETUP -#line 426 "lexer.l" +#line 420 "lexer.l" { yylval.id = g_strdup(yytext); return ARRAY_DIM; @@ -1748,7 +1742,7 @@ YY_RULE_SETUP YY_BREAK case 82: YY_RULE_SETUP -#line 431 "lexer.l" +#line 425 "lexer.l" { BEGIN(CLASS_CODE_I); return '{'; @@ -1756,7 +1750,7 @@ YY_RULE_SETUP YY_BREAK case 83: YY_RULE_SETUP -#line 435 "lexer.l" +#line 429 "lexer.l" { BEGIN(C_CODE); parenth_depth=1; @@ -1769,7 +1763,7 @@ YY_RULE_SETUP YY_BREAK case 84: YY_RULE_SETUP -#line 444 "lexer.l" +#line 438 "lexer.l" { BEGIN(INITIAL); return '}'; @@ -1777,12 +1771,12 @@ YY_RULE_SETUP YY_BREAK case 85: YY_RULE_SETUP -#line 449 "lexer.l" +#line 443 "lexer.l" ; /*ignore*/ YY_BREAK case 86: YY_RULE_SETUP -#line 451 "lexer.l" +#line 445 "lexer.l" { yylval.line = line_no; return yytext[0]; @@ -1790,15 +1784,15 @@ YY_RULE_SETUP YY_BREAK case 87: YY_RULE_SETUP -#line 456 "lexer.l" +#line 450 "lexer.l" ; /*ignore*/ YY_BREAK case 88: YY_RULE_SETUP -#line 458 "lexer.l" +#line 452 "lexer.l" ECHO; YY_BREAK -#line 1802 "lex.yy.c" +#line 1796 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(C_CODE): @@ -2688,7 +2682,7 @@ int main() return 0; } #endif -#line 458 "lexer.l" +#line 452 "lexer.l" /* Ugly warning avoiding */