Refactor macro args to be owned collectively by their fstack contexts

This commit is contained in:
Rangi42
2024-03-22 13:22:28 -04:00
committed by Sylvie
parent b85c5cde8f
commit 507439bc25
10 changed files with 78 additions and 84 deletions

View File

@@ -522,7 +522,7 @@ macro_args:
}
| macro_args STRING {
$$ = std::move($1);
$$->append(std::make_shared<std::string>($2));
$$->appendArg(std::make_shared<std::string>($2));
}
;
@@ -843,10 +843,18 @@ assert:
shift:
POP_SHIFT {
macro_ShiftCurrentArgs(1);
if (MacroArgs *macroArgs = fstk_GetCurrentMacroArgs(); macroArgs) {
macroArgs->shiftArgs(1);
} else {
::error("Cannot shift macro arguments outside of a macro\n");
}
}
| POP_SHIFT const {
macro_ShiftCurrentArgs($2);
if (MacroArgs *macroArgs = fstk_GetCurrentMacroArgs(); macroArgs) {
macroArgs->shiftArgs($2);
} else {
::error("Cannot shift macro arguments outside of a macro\n");
}
}
;