Now '@' is valid as a relocexpr_no_str, in 'BANK(@)', and
in 'DEF(@)', but not in general T_ID or T_LABEL contexts
This will make it easier to implement INCBIN with 'ld'
There are 13 shift/reduce conflicts, so some instructions
may need different formats.
This also does not yet implement `db`, `dw`, `dl`, `ds`,
or `INCBIN` using `ld`.
The `lexerState->nextToken` solution to lexing something
like "a.2" as three tokens instead of one identifier
is taken from the first commit in rgbds PR #799.
Explicit {interpolation} can still achieve this, but
to match DEF, REDEF, and PURGE, these new directives that
define symbols do not expand string EQUS.
This was removed in b3c0db218d
(along with two unrelated changes).
Removing this hack introduced issue #742, whereby INCLUDing
a file without a trailing newline can cause a syntax error.
A more proper fix would involve Bison's tracking locations,
but for now the EOF-newline hack fixes the issue while only
affecting some reported errors (expecting "newline"
instead of "end of file").
Fixes#742
* Mark `error` as a `format` function, to properly scan its format
* Fix the call to error() from parser.y:
- Use '%s' to avoid passing an arbitrary format
- Simplify yyerror overall
* Fix size parameter of %.*s format being an int... bonkers standard.
* Report the number of arguments required and provided on a STRFMT mismatch
* Add an assert to check for a very unlikely bug
This applies to macro arguments, DB, DW, DL, DS,
PRINT, PRINTLN, EXPORT, PURGE, and OPT.
It also removes support for empty entries in DB/DW/DL.
(Deprecating it would require keeping parser support,
which is ambiguous with trailing commas.)
Fixes#753
In preparation for an upcoming change
Makes for nicer error messages, complaining about EOF instead of newlines
The hack had to be kept for the lexer raw mode to avoid a bug;
see the relevant code comment for more info.
Simplify the mess that was option setting (2 redundant variables !?)
Move options to a separate file
Have "modules" own their options, and OPT only access them (less redundancy)
Simplify code, respect naming conventions better
This is not used in all bison versions, which causes a
"defined but not used" warning for the 'rgbasm_yytnamerr'
replacement, treated as an error by 'make develop'.
Removal of colon-less labels lifted the grammar ambiguity that
prevented `RL` from being usable as a variable declarator.
Thus, reinstate its functionality.