mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Restore the "EOF-newline" lexer hack
This was removed in b3c0db218d
(along with two unrelated changes).
Removing this hack introduced issue #742, whereby INCLUDing
a file without a trailing newline can cause a syntax error.
A more proper fix would involve Bison's tracking locations,
but for now the EOF-newline hack fixes the issue while only
affecting some reported errors (expecting "newline"
instead of "end of file").
Fixes #742
This commit is contained in:
@@ -603,20 +603,19 @@ enum {
|
||||
|
||||
%%
|
||||
|
||||
asmfile : lines last_line
|
||||
asmfile : lines
|
||||
;
|
||||
|
||||
/* Note: The lexer adds T_NEWLINE at the end of the input */
|
||||
lines : %empty
|
||||
| lines line
|
||||
;
|
||||
|
||||
last_line : label
|
||||
| label cpu_command
|
||||
| label macro
|
||||
| label directive
|
||||
| assignment_directive
|
||||
;
|
||||
line : last_line T_NEWLINE
|
||||
line : label T_NEWLINE
|
||||
| label cpu_command T_NEWLINE
|
||||
| label macro T_NEWLINE
|
||||
| label directive T_NEWLINE
|
||||
| assignment_directive T_NEWLINE
|
||||
| line_directive /* Directives that manage newlines themselves */
|
||||
| error T_NEWLINE { /* Continue parsing the next line on a syntax error */
|
||||
fstk_StopRept();
|
||||
|
||||
Reference in New Issue
Block a user