Commit 608a96c7 authored by Bart Trojanowski's avatar Bart Trojanowski Committed by Stephen Hemminger

fix build issues with flex ver 2.5

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.
parent 4ec1933d
......@@ -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);
}
<str>\" {
<lexstr>\" {
BEGIN(INITIAL);
yylval.b = bstr_new(strbuf, strbuf_index);
yylval.b->quoted = 1;
return ATTRIBUTE;
}
<str>\\[0-7]{1,3} { /* octal escape sequence */
<lexstr>\\[0-7]{1,3} { /* octal escape sequence */
int res;
sscanf(yytext + 1, "%o", &res);
......@@ -100,12 +100,12 @@
strbuf_append_char((unsigned char) res);
}
<str>\\[0-9]+ { /* catch wrong octal escape seq. */
<lexstr>\\[0-9]+ { /* catch wrong octal escape seq. */
fprintf(stderr, "error: invalid octale escape sequence\n");
return ERROR;
}
<str>\\x[0-9a-fA-F]{1,2} {
<lexstr>\\x[0-9a-fA-F]{1,2} {
int res;
sscanf(yytext + 2, "%x", &res);
......@@ -118,16 +118,16 @@
strbuf_append_char((unsigned char) res);
}
<str>\\n strbuf_append_char('\n');
<str>\\r strbuf_append_char('\r');
<str>\\t strbuf_append_char('\t');
<str>\\v strbuf_append_char('\v');
<str>\\b strbuf_append_char('\b');
<str>\\f strbuf_append_char('\f');
<str>\\a strbuf_append_char('\a');
<lexstr>\\n strbuf_append_char('\n');
<lexstr>\\r strbuf_append_char('\r');
<lexstr>\\t strbuf_append_char('\t');
<lexstr>\\v strbuf_append_char('\v');
<lexstr>\\b strbuf_append_char('\b');
<lexstr>\\f strbuf_append_char('\f');
<lexstr>\\a strbuf_append_char('\a');
<str>\\(.|\n) strbuf_append_char(yytext[1]);
<str>[^\\\n\"]+ strbuf_append_charp(yytext);
<lexstr>\\(.|\n) strbuf_append_char(yytext[1]);
<lexstr>[^\\\n\"]+ strbuf_append_charp(yytext);
[aA][nN][dD] return AND;
[oO][rR] return OR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment