wrc: Add a workaround for older bison versions.

Bison < 3.6 doesn't apply api.prefix to YYEMPTY.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-01-21 23:30:59 +01:00
parent 599ecd97a8
commit c09a5da157
2 changed files with 7 additions and 5 deletions

View File

@ -483,8 +483,7 @@ typedecl:
cppquote: tCPPQUOTE '(' aSTRING ')' { $$ = $3; }
;
import_start: tIMPORT aSTRING ';' { assert(yychar == PARSER_EMPTY);
$$ = xmalloc(sizeof(struct _import_t));
import_start: tIMPORT aSTRING ';' { $$ = xmalloc(sizeof(struct _import_t));
$$->name = $2;
$$->import_performed = do_import($2);
if (!$$->import_performed) yychar = aEOF;

View File

@ -199,6 +199,9 @@ static resource_t *build_fontdirs(resource_t *tail);
static resource_t *build_fontdir(resource_t **fnt, int nfnt);
static int rsrcid_to_token(int lookahead);
/* bison >= 3.6 applies api.prefix also to YYEMPTY */
#define YYEMPTY (-2)
%}
%define api.prefix {parser_}
@ -490,11 +493,11 @@ resource
* want_id because we already have a lookahead that
* cannot be undone.
*/
if(yychar != PARSER_EMPTY && yychar != tNL)
if(yychar != YYEMPTY && yychar != tNL)
dont_want_id = 1;
if(yychar == tNL)
yychar = PARSER_EMPTY; /* Could use 'yyclearin', but we already need the*/
yychar = YYEMPTY; /* Could use 'yyclearin', but we already need the*/
/* direct access to yychar in rule 'usrcvt' below. */
else if(yychar == tIDENT)
parser_warning("LANGUAGE statement not delimited with newline; next identifier might be wrong\n");
@ -2725,7 +2728,7 @@ static int rsrcid_to_token(int lookahead)
int token;
/* Get a token if we don't have one yet */
if(lookahead == PARSER_EMPTY)
if(lookahead == YYEMPTY)
lookahead = yylex();
/* Only numbers are possibly interesting */