xo-reader2: bugfix: checkpoint before allocating SSMs

This commit is contained in:
Roland Conybeare 2026-02-16 11:03:09 -05:00
commit 66d9bc5cd6
18 changed files with 78 additions and 36 deletions

View file

@ -87,8 +87,12 @@ namespace xo {
/** create instance using memory from @p parser_mm.
* Initial expression scaffold @p def_expr
**/
static DDefineSsm * make(DArena & parser_mm,
DDefineExpr * def_expr);
static DDefineSsm * _make(DArena & parser_mm,
DDefineExpr * def_expr);
/** create fop referring to new DDefineSsm **/
static obj<ASyntaxStateMachine,DDefineSsm> make(DArena & parser_mm,
DDefineExpr * def_expr);
/** start nested parser for a define-expression,
* on top of parser state machine @p p_psm

View file

@ -62,7 +62,10 @@ namespace xo {
/** create instance using memory from @p parser_mm
**/
static DParenSsm * make(DArena & parser_mm);
static DParenSsm * _make(DArena & parser_mm);
/** create fop pointing with new DParenSsm using memory from @p parser_mm **/
static obj<ASyntaxStateMachine,DParenSsm> make(DArena & parser_mm);
/** push DParenSsm instance onto @p p_psm stack **/
static void start(ParserStateMachine * p_psm);

View file

@ -30,9 +30,11 @@ namespace xo {
ParserStack * parent);
/** create new top of stack for syntax @p ssm, using memory from @p mm.
* previous stack given by @p parent
* previous stack given by @p parent.
* Checkpoint @p ckp will refer to stack _before_ allocating @p ssm
**/
static ParserStack * push(ParserStack * stack,
DArena::Checkpoint ckp,
DArena & mm,
obj<ASyntaxStateMachine> ssm);

View file

@ -97,8 +97,10 @@ namespace xo {
/** establish toplevel @p ssm. Must have empty stack **/
void establish_toplevel_ssm(obj<ASyntaxStateMachine> ssm);
/** push syntax @p ssm onto @ref stack_ **/
void push_ssm(obj<ASyntaxStateMachine> ssm);
/** push syntax @p ssm onto @ref stack_, restore parser stack to @p ckp
* when popped
**/
void push_ssm(DArena::Checkpoint ckp, obj<ASyntaxStateMachine> ssm);
/** pop syntax state machine from top of @ref stack_ **/
void pop_ssm();