From 608a96c727db69498c1310f21e73045c95f2ad5d Mon Sep 17 00:00:00 2001 From: Bart Trojanowski Date: Mon, 19 Apr 2010 09:12:57 -0400 Subject: [PATCH] fix build issues with flex ver 2.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When building on an old environment, the flex generated tc/emp_ematch.lex.c file would not compile. The error given was: emp_ematch.lex.c:1686: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant The emp_ematch.l uses 'str' as a start symbol name, and flex would create a '#define str 1' statement. This particular version of flex, unfortunately, used 'str' as names of string variables in the generated parser functions. This is line 1686 in the generated file: YY_BUFFER_STATE ematch__scan_string (yyconst char * str ) This patch just substitutes 'str' for 'lexstr' in emp_ematch.l to avoid the collision. --- tc/emp_ematch.l | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tc/emp_ematch.l b/tc/emp_ematch.l index 0184753..d9b45be 100644 --- a/tc/emp_ematch.l +++ b/tc/emp_ematch.l @@ -63,7 +63,7 @@ %} -%x str +%x lexstr %option 8bit stack warn noyywrap prefix="ematch_" %% @@ -78,17 +78,17 @@ } strbuf_index = 0; - BEGIN(str); + BEGIN(lexstr); } -\" { +\" { BEGIN(INITIAL); yylval.b = bstr_new(strbuf, strbuf_index); yylval.b->quoted = 1; return ATTRIBUTE; } -\\[0-7]{1,3} { /* octal escape sequence */ +\\[0-7]{1,3} { /* octal escape sequence */ int res; sscanf(yytext + 1, "%o", &res); @@ -100,12 +100,12 @@ strbuf_append_char((unsigned char) res); } -\\[0-9]+ { /* catch wrong octal escape seq. */ +\\[0-9]+ { /* catch wrong octal escape seq. */ fprintf(stderr, "error: invalid octale escape sequence\n"); return ERROR; } -\\x[0-9a-fA-F]{1,2} { +\\x[0-9a-fA-F]{1,2} { int res; sscanf(yytext + 2, "%x", &res); @@ -118,16 +118,16 @@ strbuf_append_char((unsigned char) res); } -\\n strbuf_append_char('\n'); -\\r strbuf_append_char('\r'); -\\t strbuf_append_char('\t'); -\\v strbuf_append_char('\v'); -\\b strbuf_append_char('\b'); -\\f strbuf_append_char('\f'); -\\a strbuf_append_char('\a'); +\\n strbuf_append_char('\n'); +\\r strbuf_append_char('\r'); +\\t strbuf_append_char('\t'); +\\v strbuf_append_char('\v'); +\\b strbuf_append_char('\b'); +\\f strbuf_append_char('\f'); +\\a strbuf_append_char('\a'); -\\(.|\n) strbuf_append_char(yytext[1]); -[^\\\n\"]+ strbuf_append_charp(yytext); +\\(.|\n) strbuf_append_char(yytext[1]); +[^\\\n\"]+ strbuf_append_charp(yytext); [aA][nN][dD] return AND; [oO][rR] return OR; -- 2.39.2