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.
This commit is contained in:
parent
4ec1933dfd
commit
608a96c727
|
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%x str
|
%x lexstr
|
||||||
|
|
||||||
%option 8bit stack warn noyywrap prefix="ematch_"
|
%option 8bit stack warn noyywrap prefix="ematch_"
|
||||||
%%
|
%%
|
||||||
|
|
@ -78,17 +78,17 @@
|
||||||
}
|
}
|
||||||
strbuf_index = 0;
|
strbuf_index = 0;
|
||||||
|
|
||||||
BEGIN(str);
|
BEGIN(lexstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
<str>\" {
|
<lexstr>\" {
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
yylval.b = bstr_new(strbuf, strbuf_index);
|
yylval.b = bstr_new(strbuf, strbuf_index);
|
||||||
yylval.b->quoted = 1;
|
yylval.b->quoted = 1;
|
||||||
return ATTRIBUTE;
|
return ATTRIBUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
<str>\\[0-7]{1,3} { /* octal escape sequence */
|
<lexstr>\\[0-7]{1,3} { /* octal escape sequence */
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
sscanf(yytext + 1, "%o", &res);
|
sscanf(yytext + 1, "%o", &res);
|
||||||
|
|
@ -100,12 +100,12 @@
|
||||||
strbuf_append_char((unsigned char) res);
|
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");
|
fprintf(stderr, "error: invalid octale escape sequence\n");
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
<str>\\x[0-9a-fA-F]{1,2} {
|
<lexstr>\\x[0-9a-fA-F]{1,2} {
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
sscanf(yytext + 2, "%x", &res);
|
sscanf(yytext + 2, "%x", &res);
|
||||||
|
|
@ -118,16 +118,16 @@
|
||||||
strbuf_append_char((unsigned char) res);
|
strbuf_append_char((unsigned char) res);
|
||||||
}
|
}
|
||||||
|
|
||||||
<str>\\n strbuf_append_char('\n');
|
<lexstr>\\n strbuf_append_char('\n');
|
||||||
<str>\\r strbuf_append_char('\r');
|
<lexstr>\\r strbuf_append_char('\r');
|
||||||
<str>\\t strbuf_append_char('\t');
|
<lexstr>\\t strbuf_append_char('\t');
|
||||||
<str>\\v strbuf_append_char('\v');
|
<lexstr>\\v strbuf_append_char('\v');
|
||||||
<str>\\b strbuf_append_char('\b');
|
<lexstr>\\b strbuf_append_char('\b');
|
||||||
<str>\\f strbuf_append_char('\f');
|
<lexstr>\\f strbuf_append_char('\f');
|
||||||
<str>\\a strbuf_append_char('\a');
|
<lexstr>\\a strbuf_append_char('\a');
|
||||||
|
|
||||||
<str>\\(.|\n) strbuf_append_char(yytext[1]);
|
<lexstr>\\(.|\n) strbuf_append_char(yytext[1]);
|
||||||
<str>[^\\\n\"]+ strbuf_append_charp(yytext);
|
<lexstr>[^\\\n\"]+ strbuf_append_charp(yytext);
|
||||||
|
|
||||||
[aA][nN][dD] return AND;
|
[aA][nN][dD] return AND;
|
||||||
[oO][rR] return OR;
|
[oO][rR] return OR;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue