Print a more user-friendly error message for leftover diff marks
@@ -690,17 +690,19 @@ asmfile : lines
;
lines : %empty
- | lines line
+ | lines opt_diff_mark line
;
endofline : T_NEWLINE | T_EOB
;
-plain_directive : label
- | label cpu_command
- | label macro
- | label directive
- | assignment_directive
+opt_diff_mark : %empty // OK
+ | T_OP_ADD {
+ error("syntax error, unexpected + at the beginning of the line (is it a leftover diff mark?)\n");
+ }
+ | T_OP_SUB {
+ error("syntax error, unexpected - at the beginning of the line (is it a leftover diff mark?)\n");
+ }
;
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 {
lexer_DecIFDepth();
}
