mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Factor out a 'plain_directive' parser rule similar to the reverted 'last_line'
Also expand on the comment explaining how the EOF-newline hack affects the parser
This commit is contained in:
@@ -606,16 +606,22 @@ enum {
|
||||
asmfile : lines
|
||||
;
|
||||
|
||||
/* Note: The lexer adds T_NEWLINE at the end of the input */
|
||||
/*
|
||||
* The lexer adds T_NEWLINE at the end of the file if one was not
|
||||
* already present, so we can rely on it to end a line.
|
||||
*/
|
||||
lines : %empty
|
||||
| lines line
|
||||
;
|
||||
|
||||
line : label T_NEWLINE
|
||||
| label cpu_command T_NEWLINE
|
||||
| label macro T_NEWLINE
|
||||
| label directive T_NEWLINE
|
||||
| assignment_directive T_NEWLINE
|
||||
plain_directive : label
|
||||
| label cpu_command
|
||||
| label macro
|
||||
| label directive
|
||||
| assignment_directive
|
||||
;
|
||||
|
||||
line : plain_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