mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
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::`.
This commit is contained in:
@@ -688,6 +688,15 @@ line : plain_directive endofline
|
||||
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;
|
||||
}
|
||||
;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user