mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Avoid using Bison's typed mid-rule actions
These work with `%union`, but will not work with C++ `variant`
This commit is contained in:
@@ -266,6 +266,9 @@
|
|||||||
%token T_SECT_WRAM0 "WRAM0" T_SECT_WRAMX "WRAMX" T_SECT_HRAM "HRAM"
|
%token T_SECT_WRAM0 "WRAM0" T_SECT_WRAMX "WRAMX" T_SECT_HRAM "HRAM"
|
||||||
%token T_SECT_VRAM "VRAM" T_SECT_SRAM "SRAM" T_SECT_OAM "OAM"
|
%token T_SECT_VRAM "VRAM" T_SECT_SRAM "SRAM" T_SECT_OAM "OAM"
|
||||||
|
|
||||||
|
%type <captureTerminated> capture_rept
|
||||||
|
%type <captureTerminated> capture_macro
|
||||||
|
|
||||||
%type <sectMod> sectmod
|
%type <sectMod> sectmod
|
||||||
%type <macroArg> macroargs
|
%type <macroArg> macroargs
|
||||||
|
|
||||||
@@ -834,10 +837,8 @@ load:
|
|||||||
;
|
;
|
||||||
|
|
||||||
rept:
|
rept:
|
||||||
T_POP_REPT uconst T_NEWLINE {
|
T_POP_REPT uconst T_NEWLINE capture_rept endofline {
|
||||||
$<captureTerminated>$ = lexer_CaptureRept(captureBody);
|
if ($4)
|
||||||
} endofline {
|
|
||||||
if ($<captureTerminated>4)
|
|
||||||
fstk_RunRept($2, captureBody.lineNo, captureBody.body, captureBody.size);
|
fstk_RunRept($2, captureBody.lineNo, captureBody.body, captureBody.size);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -847,10 +848,8 @@ for:
|
|||||||
lexer_ToggleStringExpansion(false);
|
lexer_ToggleStringExpansion(false);
|
||||||
} T_ID {
|
} T_ID {
|
||||||
lexer_ToggleStringExpansion(true);
|
lexer_ToggleStringExpansion(true);
|
||||||
} T_COMMA for_args T_NEWLINE {
|
} T_COMMA for_args T_NEWLINE capture_rept endofline {
|
||||||
$<captureTerminated>$ = lexer_CaptureRept(captureBody);
|
if ($8)
|
||||||
} endofline {
|
|
||||||
if ($<captureTerminated>8)
|
|
||||||
fstk_RunFor(
|
fstk_RunFor(
|
||||||
$3,
|
$3,
|
||||||
$6.start,
|
$6.start,
|
||||||
@@ -863,6 +862,12 @@ for:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
capture_rept:
|
||||||
|
%empty {
|
||||||
|
$$ = lexer_CaptureRept(captureBody);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
for_args:
|
for_args:
|
||||||
const {
|
const {
|
||||||
$$.start = 0;
|
$$.start = 0;
|
||||||
@@ -893,14 +898,18 @@ macrodef:
|
|||||||
lexer_ToggleStringExpansion(false);
|
lexer_ToggleStringExpansion(false);
|
||||||
} T_ID {
|
} T_ID {
|
||||||
lexer_ToggleStringExpansion(true);
|
lexer_ToggleStringExpansion(true);
|
||||||
} T_NEWLINE {
|
} T_NEWLINE capture_macro endofline {
|
||||||
$<captureTerminated>$ = lexer_CaptureMacroBody(captureBody);
|
if ($6)
|
||||||
} endofline {
|
|
||||||
if ($<captureTerminated>6)
|
|
||||||
sym_AddMacro($3, captureBody.lineNo, captureBody.body, captureBody.size);
|
sym_AddMacro($3, captureBody.lineNo, captureBody.body, captureBody.size);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
capture_macro:
|
||||||
|
%empty {
|
||||||
|
$$ = lexer_CaptureMacroBody(captureBody);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
rsset:
|
rsset:
|
||||||
T_POP_RSSET uconst {
|
T_POP_RSSET uconst {
|
||||||
sym_AddVar("_RS", $2);
|
sym_AddVar("_RS", $2);
|
||||||
@@ -1170,7 +1179,7 @@ print_expr:
|
|||||||
printf("$%" PRIX32, $1);
|
printf("$%" PRIX32, $1);
|
||||||
}
|
}
|
||||||
| string {
|
| string {
|
||||||
printf("%s", $1);
|
fputs($1, stdout);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user