Skip to content

Commit

Permalink
Make EOF token name consistent across Bison versions
Browse files Browse the repository at this point in the history
The "end of file" name apparently only became a default recently
  • Loading branch information
ISSOtm committed Feb 11, 2021
1 parent b3c0db2 commit 88e1cc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/asm/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ static int yylex_NORMAL(void)
return T_NEWLINE;

case EOF:
return 0;
return T_EOF;

/* Handle escapes */

Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -2163,16 +2163,15 @@ 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 */
if (!lexerState->capturing) {
if (!yywrap())
goto restart;
dbgPrint("Reached end of input.");
return 0;
return T_EOF;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/asm/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ enum {
%type <nConstValue> op_hl_ss
%type <sVal> op_mem_ind
%type <assertType> assert_type

%token T_EOF 0 "end of file"
%start asmfile

%%
Expand Down

0 comments on commit 88e1cc7

Please sign in to comment.