Print a more user-friendly error message for leftover diff marks (#1089)

This commit is contained in:
Eldred Habert
2022-10-03 16:50:32 +02:00
committed by ISSOtm
parent 74e40654e6
commit e2136d60b2

View File

@@ -690,17 +690,19 @@ asmfile : lines
; ;
lines : %empty lines : %empty
| lines line | lines opt_diff_mark line
; ;
endofline : T_NEWLINE | T_EOB endofline : T_NEWLINE | T_EOB
; ;
plain_directive : label opt_diff_mark : %empty // OK
| label cpu_command | T_OP_ADD {
| label macro error("syntax error, unexpected + at the beginning of the line (is it a leftover diff mark?)\n");
| label directive }
| assignment_directive | T_OP_SUB {
error("syntax error, unexpected - at the beginning of the line (is it a leftover diff mark?)\n");
}
; ;
line : plain_directive endofline line : plain_directive endofline
@@ -786,6 +788,13 @@ else : T_POP_ELSE T_NEWLINE {
} }
; ;
plain_directive : label
| label cpu_command
| label macro
| label directive
| assignment_directive
;
endc : T_POP_ENDC { endc : T_POP_ENDC {
lexer_DecIFDepth(); lexer_DecIFDepth();
} }