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:
Rangi
2021-03-02 19:35:24 -05:00
committed by Rangi
parent 40c6b840f8
commit 6655e04ef0
4 changed files with 31 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
ERROR: block-comment-termination-error.asm(1):
Unterminated block comment
ERROR: block-comment-termination-error.asm(1):
syntax error, unexpected end of file
syntax error, unexpected newline
error: Assembly aborted (2 errors)!

View File

@@ -7,9 +7,9 @@ ERROR: code-after-endm-endr-endc.asm(12):
ERROR: code-after-endm-endr-endc.asm(17):
syntax error, unexpected PRINTLN, expecting newline
ERROR: code-after-endm-endr-endc.asm(19):
syntax error, unexpected PRINTLN, expecting end of file or newline
syntax error, unexpected PRINTLN, expecting newline
ERROR: code-after-endm-endr-endc.asm(23):
syntax error, unexpected PRINTLN, expecting newline
ERROR: code-after-endm-endr-endc.asm(25):
syntax error, unexpected PRINTLN, expecting end of file or newline
syntax error, unexpected PRINTLN, expecting newline
error: Assembly aborted (7 errors)!