ref: 0068c1375ca08a633c61c5c70201331a4fe15540
parent: 872af9c7edc7dd8580456b1e23f1bd10d1b40974
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Fri May 21 13:09:23 EDT 2021
Syntax error message hints to indent macro invocations This message is only printed for identifiers parsed as `T_LABEL` (since they're at the start of a line) but already defined as macros. Otherwise it may not be relevant, e.g. for `MyLabel;:` or `My Label::`.
--- a/src/asm/parser.y
+++ b/src/asm/parser.y
@@ -688,6 +688,15 @@
fstk_StopRept();
yyerrok;
}
+ | T_LABEL error endofline { /* Hint about unindented macros parsed as labels */
+ struct Symbol *macro = sym_FindExactSymbol($1);
+
+ if (macro && macro->type == SYM_MACRO)
+ fprintf(stderr,
+ " To invoke `%s` as a macro it must be indented\n", $1);
+ fstk_StopRept();
+ yyerrok;
+ }
;
/*
--- a/test/asm/syntax-error-after-syntax-error.err
+++ b/test/asm/syntax-error-after-syntax-error.err
@@ -2,8 +2,10 @@
syntax error, unexpected newline
ERROR: syntax-error-after-syntax-error.asm(7):
syntax error, unexpected newline
+ To invoke `mac` as a macro it must be indented
ERROR: syntax-error-after-syntax-error.asm(8):
syntax error, unexpected number
+ To invoke `mac` as a macro it must be indented
ERROR: syntax-error-after-syntax-error.asm(9):
'mac' already defined at syntax-error-after-syntax-error.asm(1)
ERROR: syntax-error-after-syntax-error.asm(10):
--- a/test/asm/syntax-error-after-syntax-error.simple.err
+++ b/test/asm/syntax-error-after-syntax-error.simple.err
@@ -2,8 +2,10 @@
syntax error
ERROR: syntax-error-after-syntax-error.asm(7):
syntax error
+ To invoke `mac` as a macro it must be indented
ERROR: syntax-error-after-syntax-error.asm(8):
syntax error
+ To invoke `mac` as a macro it must be indented
ERROR: syntax-error-after-syntax-error.asm(9):
'mac' already defined at syntax-error-after-syntax-error.asm(1)
ERROR: syntax-error-after-syntax-error.asm(10):