X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/3379dcdfd0872947d761053c61d773add94d38c2..853c670e4b839fd435507201f04d16080590a894:/src/lexer.l diff --git a/src/lexer.l b/src/lexer.l index b155aa7..f45fcc5 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -51,9 +51,9 @@ static void clear_cbuf(void) { if(!cbuf) { - cbuf = g_string_new(""); + cbuf = g_string_new(NULL); } else { - cbuf = g_string_assign(cbuf,""); + cbuf = g_string_assign(cbuf, ""); } } @@ -81,6 +81,10 @@ add_gtk_doc_func(void) gtk_doc_func = NULL; } +/* Ugly warning avoiding */ +#ifdef FLEX_SCANNER +int yylex(void); +#endif %} @@ -330,9 +334,8 @@ class { 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; @@ -350,26 +353,21 @@ class { 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); } } class|this { 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; } @@ -395,11 +393,12 @@ class { public {yylval.line = line_no; return PUBLIC;} private {yylval.line = line_no; return PRIVATE;} protected {yylval.line = line_no; return PROTECTED;} +classwide {yylval.line = line_no; return CLASSWIDE;} argument {yylval.line = line_no; return ARGUMENT;} virtual {yylval.line = line_no; return VIRTUAL;} signal {yylval.line = line_no; return SIGNAL;} override {yylval.line = line_no; return OVERRIDE;} -0|[1-9][0-9]*|0x[0-9a-fA-F]+|0[0-7]+|[0-9]*\.[0-9]+|\.[0-9][0-9]* { +0|[1-9][0-9]*|0x[0-9a-fA-F]+|0[0-7]+|[0-9]*\.[0-9]+|\.[0-9][0-9]* { yylval.id = g_strdup(yytext); return NUMBER; } @@ -418,7 +417,7 @@ class { return TOKEN; } -(\[[0-9]*\])+ { +(\[[0-9]*\]|\[[A-Za-z_][A-Za-z0-9_]*\])+ { yylval.id = g_strdup(yytext); return ARRAY_DIM; } @@ -449,3 +448,16 @@ class { } <*>[\n\r] ; /*ignore*/ + +%% + +/* Ugly warning avoiding */ +#ifdef FLEX_SCANNER +static void warning_avoider(void) G_GNUC_UNUSED; +static void warning_avoider(void) { + yy_flex_realloc(NULL, 0); + yyunput(0, NULL); + warning_avoider(); +} +#endif +