mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Fix incorrect lexing of "$ff00+c" (#882)
Fixes #881 by moving the task from the lexer to the parser. This both alleviates the need for backtracking in the lexer, removing what is (was) arguably a hack, and causes tokenization boundaries to be properly respected, fixing the issue mentioned above. Co-authored-by: Rangi <remy.oukaour+rangi42@gmail.com>
This commit is contained in:
@@ -646,7 +646,6 @@ enum {
|
||||
%token T_TOKEN_D "d" T_TOKEN_E "e"
|
||||
%token T_TOKEN_H "h" T_TOKEN_L "l"
|
||||
%token T_MODE_AF "af" T_MODE_BC "bc" T_MODE_DE "de" T_MODE_SP "sp"
|
||||
%token T_MODE_HW_C "$ff00+c"
|
||||
%token T_MODE_HL "hl" T_MODE_HL_DEC "hld/hl-" T_MODE_HL_INC "hli/hl+"
|
||||
%token T_CC_NZ "nz" T_CC_Z "z" T_CC_NC "nc" // There is no T_CC_C, only T_TOKEN_C
|
||||
|
||||
@@ -1861,7 +1860,10 @@ z80_ldio : T_Z80_LDH T_MODE_A T_COMMA op_mem_ind {
|
||||
;
|
||||
|
||||
c_ind : T_LBRACK T_MODE_C T_RBRACK
|
||||
| T_LBRACK T_MODE_HW_C T_RBRACK
|
||||
| T_LBRACK relocexpr T_OP_ADD T_MODE_C T_RBRACK {
|
||||
if (!rpn_isKnown(&$2) || $2.val != 0xff00)
|
||||
error("Expected constant expression equal to $FF00 for \"$ff00+c\"\n");
|
||||
}
|
||||
;
|
||||
|
||||
z80_ld : z80_ld_mem
|
||||
|
||||
Reference in New Issue
Block a user