xo-reader2: + SyntaxStateMachine.forward_children method

Support gc traversal with goal of making ParserStateMachine a gc root
This commit is contained in:
Roland Conybeare 2026-03-24 17:43:45 -04:00
commit 3af72fec64
91 changed files with 626 additions and 39 deletions

View file

@ -21,6 +21,7 @@ namespace xo {
**/
class ParserStack {
public:
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -42,6 +43,8 @@ namespace xo {
static ParserStack * pop(ParserStack * stack,
DArena & mm);
static constexpr bool is_gc_eligible() { return false; }
DArena::Checkpoint ckp() const noexcept { return ckp_; }
obj<ASyntaxStateMachine> top() const noexcept { return ssm_; }
ParserStack * parent() const noexcept { return parent_; }
@ -51,6 +54,8 @@ namespace xo {
/** pretty-printer support **/
bool pretty(const ppindentinfo & ppii) const;
void forward_children(obj<ACollector> gc) noexcept;
private:
/** stack pointer: top of stack just before this instance created **/
DArena::Checkpoint ckp_;