From bb011e28a98610727f73bb8d0e4aafa8d5ba8fbc Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 27 Jan 2022 20:17:21 +1300 Subject: [PATCH] Try to fix Bison portability issue YYEOF works as a token for "end of file" on my dev box but fails in CI. I assume it must be a Bison version difference. Based on the Bison manual, I'm trying this fix (which also works on my dev box). --- Source/CParse/parser.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index c487f3b93..dfbfa43b6 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1587,6 +1587,9 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) Node *node; }; +// Define special token END for end of input. +%token END 0 + %token ID %token HBLOCK %token POUND @@ -2010,7 +2013,7 @@ constant_directive : CONSTANT identifier EQUAL definetype SEMI { Swig_warning(WARN_PARSE_BAD_VALUE,cparse_file,cparse_line,"Bad constant value (ignored).\n"); $$ = 0; } - | CONSTANT error YYEOF { + | CONSTANT error END { Swig_error(cparse_file,cparse_line,"Missing ';' after %%constant.\n"); SWIG_exit(EXIT_FAILURE); }