xo-reader2: bugfix: move toplevel ExprSeqState to parser stack

This commit is contained in:
Roland Conybeare 2026-02-16 11:08:21 -05:00
commit f48927a4be
3 changed files with 10 additions and 8 deletions

View file

@ -41,16 +41,17 @@ namespace xo {
using Super = DSyntaxStateMachine<DExprSeqState>; using Super = DSyntaxStateMachine<DExprSeqState>;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
public: public:
explicit DExprSeqState(exprseqtype ty); explicit DExprSeqState(exprseqtype ty);
/** start interactive top-level session **/ /** start interactive top-level session **/
static void establish_interactive(obj<AAllocator> mm, static void establish_interactive(DArena & mm,
ParserStateMachine * p_psm); ParserStateMachine * p_psm);
/** start non-interactive top-level session **/ /** start non-interactive top-level session **/
static void establish_batch(obj<AAllocator> mm, static void establish_batch(DArena & mm,
ParserStateMachine * p_psm); ParserStateMachine * p_psm);
public: public:

View file

@ -35,6 +35,7 @@ namespace xo {
using xo::scm::DFloat; using xo::scm::DFloat;
using xo::mm::AGCObject; using xo::mm::AGCObject;
using xo::mm::AAllocator; using xo::mm::AAllocator;
using xo::mm::DArena;
using xo::facet::with_facet; using xo::facet::with_facet;
using xo::reflect::typeseq; using xo::reflect::typeseq;
@ -59,7 +60,7 @@ namespace xo {
namespace { namespace {
obj<ASyntaxStateMachine> obj<ASyntaxStateMachine>
make_exprseq_ssm(obj<AAllocator> mm, make_exprseq_ssm(DArena & mm,
exprseqtype seqtype) exprseqtype seqtype)
{ {
void * mem = mm.alloc(typeseq::id<DExprSeqState>(), void * mem = mm.alloc(typeseq::id<DExprSeqState>(),
@ -67,12 +68,12 @@ namespace xo {
DExprSeqState * ssm = new (mem) DExprSeqState(seqtype); DExprSeqState * ssm = new (mem) DExprSeqState(seqtype);
return with_facet<ASyntaxStateMachine>::mkobj(ssm); return obj<ASyntaxStateMachine,DExprSeqState>(ssm);
} }
} }
void void
DExprSeqState::establish_interactive(obj<AAllocator> mm, DExprSeqState::establish_interactive(DArena & mm,
ParserStateMachine * p_psm) ParserStateMachine * p_psm)
{ {
p_psm->establish_toplevel_ssm(make_exprseq_ssm p_psm->establish_toplevel_ssm(make_exprseq_ssm
@ -81,7 +82,7 @@ namespace xo {
} }
void void
DExprSeqState::establish_batch(obj<AAllocator> mm, DExprSeqState::establish_batch(DArena & mm,
ParserStateMachine * p_psm) ParserStateMachine * p_psm)
{ {
p_psm->establish_toplevel_ssm(make_exprseq_ssm p_psm->establish_toplevel_ssm(make_exprseq_ssm

View file

@ -65,14 +65,14 @@ namespace xo {
void void
SchematikaParser::begin_interactive_session() SchematikaParser::begin_interactive_session()
{ {
DExprSeqState::establish_interactive(psm_.expr_alloc(), &psm_); DExprSeqState::establish_interactive(psm_.parser_alloc(), &psm_);
} }
void void
SchematikaParser::begin_batch_session() SchematikaParser::begin_batch_session()
{ {
DExprSeqState::establish_batch(psm_.expr_alloc(), &psm_); DExprSeqState::establish_batch(psm_.parser_alloc(), &psm_);
} }
const ParserResult & const ParserResult &