X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/3379dcdfd0872947d761053c61d773add94d38c2..486240dc4c5d57b0afaddba60d87fe375112bed5:/src/lexer.l diff --git a/src/lexer.l b/src/lexer.l index b155aa7..a33eed0 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 %} @@ -367,7 +371,7 @@ class { char *s; s = g_strdup_printf("'%s' keyword should not " "be used when generating " - "C++ code",yytext); + "C++ code", yytext); print_error(TRUE, s, line_no); g_free(s); } @@ -395,11 +399,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 +423,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 +454,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 +