From 88e1cc73024e3a2e242f5afce09966758c5fa589 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 11 Feb 2021 13:04:43 +0100 Subject: [PATCH] Make EOF token name consistent across Bison versions The "end of file" name apparently only became a default recently --- src/asm/lexer.c | 9 ++++----- src/asm/parser.y | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/asm/lexer.c b/src/asm/lexer.c index d28275076..c29fc26b2 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -1815,7 +1815,7 @@ static int yylex_NORMAL(void) return T_NEWLINE; case EOF: - return 0; + return T_EOF; /* Handle escapes */ @@ -2025,7 +2025,7 @@ static int skipIfBlock(bool toEndc) int c = nextChar(); if (c == EOF) { - token = 0; + token = T_EOF; goto finish; } else if (c == '\\') { /* Unconditionally skip the next char, including line conts */ @@ -2163,8 +2163,7 @@ int yylex(void) }; int token = lexerModeFuncs[lexerState->mode](); - /* Make sure to terminate files with a line feed */ - if (token == 0) { + if (token == T_EOF) { /* Try to switch to new buffer; if it succeeds, scan again */ dbgPrint("Reached EOF!\n"); /* Captures end at their buffer's boundary no matter what */ @@ -2172,7 +2171,7 @@ int yylex(void) if (!yywrap()) goto restart; dbgPrint("Reached end of input."); - return 0; + return T_EOF; } } diff --git a/src/asm/parser.y b/src/asm/parser.y index 4fbbc7907..c0e2b1419 100644 --- a/src/asm/parser.y +++ b/src/asm/parser.y @@ -581,6 +581,8 @@ enum { %type op_hl_ss %type op_mem_ind %type assert_type + +%token T_EOF 0 "end of file" %start asmfile %%