mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Make 'w' and '...' tokens, and make '@' a separate token
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'
This commit is contained in:
@@ -176,6 +176,7 @@ static struct KeywordMapping {
|
|||||||
{"E", T_TOKEN_E},
|
{"E", T_TOKEN_E},
|
||||||
{"H", T_TOKEN_H},
|
{"H", T_TOKEN_H},
|
||||||
{"L", T_TOKEN_L},
|
{"L", T_TOKEN_L},
|
||||||
|
{"W", T_TOKEN_W},
|
||||||
|
|
||||||
{"DEF", T_OP_DEF},
|
{"DEF", T_OP_DEF},
|
||||||
|
|
||||||
@@ -293,6 +294,9 @@ static struct KeywordMapping {
|
|||||||
{"OPT", T_POP_OPT},
|
{"OPT", T_POP_OPT},
|
||||||
|
|
||||||
{".", T_PERIOD},
|
{".", T_PERIOD},
|
||||||
|
{"...", T_ELLIPSIS},
|
||||||
|
|
||||||
|
{"@", T_TOKEN_AT},
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool isWhitespace(int c)
|
static bool isWhitespace(int c)
|
||||||
@@ -591,7 +595,7 @@ struct KeywordDictNode {
|
|||||||
uint16_t children[0x60 - ' '];
|
uint16_t children[0x60 - ' '];
|
||||||
struct KeywordMapping const *keyword;
|
struct KeywordMapping const *keyword;
|
||||||
/* Since the keyword structure is invariant, the min number of nodes is known at compile time */
|
/* Since the keyword structure is invariant, the min number of nodes is known at compile time */
|
||||||
} keywordDict[354] = {0}; /* Make sure to keep this correct when adding keywords! */
|
} keywordDict[357] = {0}; /* Make sure to keep this correct when adding keywords! */
|
||||||
|
|
||||||
/* Convert a char into its index into the dict */
|
/* Convert a char into its index into the dict */
|
||||||
static inline uint8_t dictIndex(char c)
|
static inline uint8_t dictIndex(char c)
|
||||||
|
|||||||
@@ -450,6 +450,7 @@ enum {
|
|||||||
%token <tzString> T_STRING "string"
|
%token <tzString> T_STRING "string"
|
||||||
|
|
||||||
%token T_PERIOD "."
|
%token T_PERIOD "."
|
||||||
|
%token T_ELLIPSIS "..."
|
||||||
%token T_COMMA ","
|
%token T_COMMA ","
|
||||||
%token T_COLON ":"
|
%token T_COLON ":"
|
||||||
%token T_LBRACK "[" T_RBRACK "]"
|
%token T_LBRACK "[" T_RBRACK "]"
|
||||||
@@ -510,6 +511,7 @@ enum {
|
|||||||
%token <tzSym> T_ID "identifier"
|
%token <tzSym> T_ID "identifier"
|
||||||
%token <tzSym> T_LOCAL_ID "local identifier"
|
%token <tzSym> T_LOCAL_ID "local identifier"
|
||||||
%token <tzSym> T_ANON "anonymous label"
|
%token <tzSym> T_ANON "anonymous label"
|
||||||
|
%token <tzSym> T_TOKEN_AT "@"
|
||||||
%type <tzSym> def_id
|
%type <tzSym> def_id
|
||||||
%type <tzSym> redef_id
|
%type <tzSym> redef_id
|
||||||
%type <tzSym> scoped_id
|
%type <tzSym> scoped_id
|
||||||
@@ -590,6 +592,7 @@ enum {
|
|||||||
%token T_TOKEN_B "b" T_TOKEN_C "c"
|
%token T_TOKEN_B "b" T_TOKEN_C "c"
|
||||||
%token T_TOKEN_D "d" T_TOKEN_E "e"
|
%token T_TOKEN_D "d" T_TOKEN_E "e"
|
||||||
%token T_TOKEN_H "h" T_TOKEN_L "l"
|
%token T_TOKEN_H "h" T_TOKEN_L "l"
|
||||||
|
%token T_TOKEN_W "w"
|
||||||
%token T_MODE_AF "af" T_MODE_BC "bc" T_MODE_DE "de" T_MODE_SP "sp" T_MODE_PC "pc"
|
%token T_MODE_AF "af" T_MODE_BC "bc" T_MODE_DE "de" T_MODE_SP "sp" T_MODE_PC "pc"
|
||||||
%token T_MODE_IME "ime"
|
%token T_MODE_IME "ime"
|
||||||
%token T_MODE_HL "hl" T_MODE_HL_DEC "hld/hl-" T_MODE_HL_INC "hli/hl+"
|
%token T_MODE_HL "hl" T_MODE_HL_DEC "hld/hl-" T_MODE_HL_INC "hli/hl+"
|
||||||
@@ -717,7 +720,7 @@ redef_id : T_POP_REDEF {
|
|||||||
;
|
;
|
||||||
|
|
||||||
scoped_id : T_ID | T_LOCAL_ID;
|
scoped_id : T_ID | T_LOCAL_ID;
|
||||||
scoped_anon_id : scoped_id | T_ANON;
|
scoped_anon_id : scoped_id | T_ANON | T_TOKEN_AT;
|
||||||
|
|
||||||
label : %empty
|
label : %empty
|
||||||
| T_COLON {
|
| T_COLON {
|
||||||
|
|||||||
Reference in New Issue
Block a user