mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Use midrule action values for captures' terminated status
Bison 3.1 introduces "typed midrule values", which would write
`<captureTerminated>{ ... }` and `$$` instead of `{ ... }` and
`$<captureTerminated>[1-9]`, but rgbds supports 3.0 or even lower.
This commit is contained in:
@@ -463,6 +463,7 @@ enum {
|
||||
int32_t step;
|
||||
} forArgs;
|
||||
struct StrFmtArgList strfmtArgs;
|
||||
bool captureTerminated;
|
||||
}
|
||||
|
||||
%type <expr> relocexpr
|
||||
@@ -987,9 +988,9 @@ load : T_POP_LOAD sectmod string T_COMMA sectiontype sectorg sectattrs {
|
||||
;
|
||||
|
||||
rept : T_POP_REPT uconst T_NEWLINE {
|
||||
lexer_CaptureRept(&captureBody);
|
||||
$<captureTerminated>$ = lexer_CaptureRept(&captureBody);
|
||||
} endofline {
|
||||
if (!captureBody.unterminated)
|
||||
if ($<captureTerminated>4)
|
||||
fstk_RunRept($2, captureBody.lineNo, captureBody.body,
|
||||
captureBody.size);
|
||||
}
|
||||
@@ -1000,9 +1001,9 @@ for : T_POP_FOR {
|
||||
} T_ID {
|
||||
lexer_ToggleStringExpansion(true);
|
||||
} T_COMMA for_args T_NEWLINE {
|
||||
lexer_CaptureRept(&captureBody);
|
||||
$<captureTerminated>$ = lexer_CaptureRept(&captureBody);
|
||||
} endofline {
|
||||
if (!captureBody.unterminated)
|
||||
if ($<captureTerminated>8)
|
||||
fstk_RunFor($3, $6.start, $6.stop, $6.step, captureBody.lineNo,
|
||||
captureBody.body, captureBody.size);
|
||||
}
|
||||
@@ -1035,16 +1036,16 @@ macrodef : T_POP_MACRO {
|
||||
} T_ID {
|
||||
lexer_ToggleStringExpansion(true);
|
||||
} T_NEWLINE {
|
||||
lexer_CaptureMacroBody(&captureBody);
|
||||
$<captureTerminated>$ = lexer_CaptureMacroBody(&captureBody);
|
||||
} endofline {
|
||||
if (!captureBody.unterminated)
|
||||
if ($<captureTerminated>6)
|
||||
sym_AddMacro($3, captureBody.lineNo, captureBody.body,
|
||||
captureBody.size);
|
||||
}
|
||||
| T_LABEL T_COLON T_POP_MACRO T_NEWLINE {
|
||||
lexer_CaptureMacroBody(&captureBody);
|
||||
$<captureTerminated>$ = lexer_CaptureMacroBody(&captureBody);
|
||||
} endofline {
|
||||
if (!captureBody.unterminated)
|
||||
if ($<captureTerminated>5)
|
||||
sym_AddMacro($1, captureBody.lineNo, captureBody.body,
|
||||
captureBody.size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user