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

@ -73,6 +73,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DDefineSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -195,6 +196,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-define-gc-support **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc);
///@}
private:
/** @defgroup scm-definessm-member-vars **/

View file

@ -18,6 +18,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DExpectExprSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -190,6 +191,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectexprssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** if true: allow a define-expression here; otherwise reject **/

View file

@ -55,6 +55,7 @@ namespace xo {
class DExpectFormalArglistSsm : public DSyntaxStateMachine<DExpectFormalArglistSsm> {
public:
using Super = DSyntaxStateMachine<DExpectFormalArglistSsm>;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using TypeDescr = xo::reflect::TypeDescr;
@ -125,6 +126,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectformalarglistssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-expectformalarglistssm-impl-methods **/

View file

@ -58,6 +58,7 @@ namespace xo {
class DExpectQArraySsm : public DSyntaxStateMachine<DExpectQArraySsm> {
public:
using Super = DSyntaxStateMachine<DExpectQArraySsm>;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using TypeDescr = xo::reflect::TypeDescr;
@ -119,6 +120,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectqarrayssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-expectqarrayssm-member-vars **/

View file

@ -58,6 +58,7 @@ namespace xo {
class DExpectQListSsm : public DSyntaxStateMachine<DExpectQListSsm> {
public:
using Super = DSyntaxStateMachine<DExpectQListSsm>;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using TypeDescr = xo::reflect::TypeDescr;
@ -119,6 +120,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectqlistssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-expectqlistssm-member-vars **/

View file

@ -15,6 +15,7 @@ namespace xo {
class DExpectQLiteralSsm : public DSyntaxStateMachine<DExpectQLiteralSsm> {
public:
using Super = DSyntaxStateMachine<DExpectQLiteralSsm>;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using TypeDescr = xo::reflect::TypeDescr;
@ -124,6 +125,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectqliteralssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-expectformalarglistssm-impl-methods **/

View file

@ -21,6 +21,7 @@ namespace xo {
class DExpectSymbolSsm : public DSyntaxStateMachine<DExpectSymbolSsm> {
public:
using Super = DSyntaxStateMachine<DExpectSymbolSsm>;
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using TypeDescr = xo::reflect::TypeDescr;
using ppindentinfo = xo::print::ppindentinfo;
@ -74,6 +75,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectsymbolssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
};
} /*namespace scm*/

View file

@ -28,6 +28,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DExpectTypeSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -82,6 +83,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expecttypessm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** temporary shim.

View file

@ -90,6 +90,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DProgressSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -214,6 +215,13 @@ namespace xo {
void print(std::ostream & os) const override;
#endif
/** @defgroup scm-progressssm-gc-support gc support methods **/
///@{
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** populate an expression here, may be followed by an operator **/
obj<AExpression> lhs_;

View file

@ -65,6 +65,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DQuoteSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -145,7 +146,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-quotessm-gc-support gc support methods */
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-parenssm-member-vars **/
///@{

View file

@ -29,8 +29,7 @@ namespace xo {
class DSequenceSsm : public DSyntaxStateMachine<DSequenceSsm> {
public:
using Super = DSyntaxStateMachine<DSequenceSsm>;
//using Sequence = xo::scm::Sequence;
//using Lambda = xo::scm::Lambda;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -87,13 +86,20 @@ namespace xo {
ParserStateMachine * p_psm);
///@}
/** @defgroup scm-sequencessm-printable-facet printable facet **/
/** @defgroup scm-sequencessm-printable-facet printable facet methods **/
///@{
/** pretty printing support **/
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-sequencessm-gcobject-facet gcobject facet methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
explicit DSequenceSsm(DSequenceExpr * seq_expr);

View file

@ -40,6 +40,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DToplevelSeqSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -156,6 +157,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-toplevelseqssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** sequence type. accept rvalue expressions when

View file

@ -32,6 +32,7 @@ namespace xo {
class ParserResult {
public:
using ACollector = xo::mm::ACollector;
using ppindentinfo = xo::print::ppindentinfo;
public:
@ -67,6 +68,9 @@ namespace xo {
/** pretty-printing support **/
bool pretty(const ppindentinfo & ppii) const;
/** gc support: forward gc-eligible children **/
void forward_children(obj<ACollector> gc) noexcept;
public:
/** none|expression|error_description
*

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_;

View file

@ -7,8 +7,8 @@
#include "ParserResult.hpp"
#include "GlobalEnv.hpp"
#include <xo/expression2/DGlobalSymtab.hpp>
#include <xo/expression2/DLocalSymtab.hpp>
#include <xo/expression2/GlobalSymtab.hpp>
#include <xo/expression2/LocalSymtab.hpp>
#include <xo/expression2/DVariable.hpp>
#include <xo/expression2/VarRef.hpp>
#include <xo/tokenizer2/Token.hpp>
@ -38,6 +38,7 @@ namespace xo {
class ParserStateMachine {
public:
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using ArenaConfig = xo::mm::ArenaConfig;
using AGCObject = xo::mm::AGCObject;
@ -66,6 +67,13 @@ namespace xo {
* (e.g. DArenaHashMap for global symtable).
* If not using X1Collector, this can be the
* same as @p expr_alloc.
*
* NOTE:
* When @p expr_alloc supports the Collector facet:
* ParserStateMachine isn't itself in gc-space
* (i.e. isn't expected to belong to @p expr_alloc).
* To update pointers to gc-owned objects, must have forward_children()
* called as part of @p expr_alloc's gc cycle.
**/
ParserStateMachine(const ArenaConfig & config,
const ArenaHashMapConfig & symtab_var_config,
@ -81,6 +89,8 @@ namespace xo {
/** non-trivial dtor for @ref global_symtab_ **/
~ParserStateMachine();
static constexpr bool is_gc_eligible() { return false; }
///@}
/** @defgroup scm-parserstatemachine-accessors accessor methods **/
///@{
@ -90,7 +100,7 @@ namespace xo {
obj<AAllocator> expr_alloc() const noexcept { return expr_alloc_; }
StringTable * stringtable() noexcept { return &stringtable_; }
DGlobalSymtab * global_symtab() const noexcept { return global_symtab_.data(); }
DLocalSymtab * local_symtab() const noexcept { return local_symtab_; }
DLocalSymtab * local_symtab() const noexcept { return local_symtab_.data(); }
DGlobalEnv * global_env() const noexcept { return global_env_.data(); }
const ParserResult & result() const noexcept { return result_; }
@ -175,7 +185,6 @@ namespace xo {
void clear_error_reset();
///@}
/** @defgroup scm-parserstatemachine-inputmethods input methods **/
///@{
@ -339,8 +348,37 @@ namespace xo {
std::string_view sym);
///@}
/** @defgroup scm-parserstatemachine-gcobject-facet gc support **/
///@{
#ifdef OBSOLETE
std::size_t shallow_size() const noexcept;
/** NOTE:
* ParserStateMachine only eligible to be a GC root.
* It's not eligible to reside in gc-owned space
**/
ParserStateMachine * shallow_copy(obj<AAllocator> mm) const noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
#endif
/** update gc-aware exit pointers from this ParserStateMachine **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
#ifdef OBSOLETE
/** @defgroup scm-parserstatemachine-impl-methods implementation methods **/
///@{
/** record gc-mutable state vars so they're updated when gc runs **/
void _add_gc_roots();
///@}
#endif
private:
/** @defgroup scm-parserstatemachine-instance-vars instance variables **/
///@{
/** Table containing interned strings + symbols.
**/
@ -348,6 +386,7 @@ namespace xo {
/** Arena for internal parsing stack.
* Must be owned exclusively because destructively
* modified as parser completes parsing of each sub-expression
*
* Contents will be a stack of ExprState instances
@ -403,7 +442,7 @@ namespace xo {
* if so, along with stringtable_.
* maybe new struct ParserState?
**/
dp<DGlobalSymtab> global_symtab_;
obj<AGCObject,DGlobalSymtab> global_symtab_;
/** symbol table with local bindings.
* non-null during parsing of lambda expressions.
@ -411,7 +450,7 @@ namespace xo {
* Push local symbol table here to remember local params
* during the body of a lambda expression.
**/
DLocalSymtab * local_symtab_ = nullptr;
obj<AGCObject,DLocalSymtab> local_symtab_;
/** global variable bindings (builtin primitives) **/
obj<AGCObject,DGlobalEnv> global_env_;
@ -435,6 +474,8 @@ namespace xo {
/** true to enable debug output **/
bool debug_flag_ = false;
///@}
};
} /*namespace scm*/
} /*namespace xo*/

View file

@ -65,6 +65,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DApplySsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -185,6 +186,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-applyssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup ssm-applyssm-impl-methods **/

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dapplyssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DApplySsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DApplySsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DApplySsm & self, obj<ACollector> gc);
///@}
};

View file

@ -66,6 +66,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DDeftypeSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -167,6 +168,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-deftypessm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-deftypessm-member-vars **/

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-ddeftypessm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DDeftypeSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DDeftypeSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DDeftypeSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -48,6 +48,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DExpectFormalArgSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -121,6 +122,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectformalargssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
#ifdef PROBABLY_NOT
virtual void on_rightparen_token(const token_type & tk,

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectformalargssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectFormalArgSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectFormalArgSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectFormalArgSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -62,6 +62,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DExpectListTypeSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -129,6 +130,13 @@ namespace xo {
/** pretty-printing support **/
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectlisttypessm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-expectlisttypessm-instance-vars instance variables **/

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectlisttypessm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectListTypeSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectListTypeSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectListTypeSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -63,6 +63,7 @@ namespace xo {
class DExpectQDictSsm : public DSyntaxStateMachine<DExpectQDictSsm> {
public:
using Super = DSyntaxStateMachine<DExpectQDictSsm>;
using ACollector = xo::mm::ACollector;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -154,6 +155,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-expectqdictssm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup ssm-expectqdictssm-member-vars **/

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectqdictssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectQDictSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectQDictSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectQDictSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -55,6 +55,7 @@ namespace xo {
class DIfElseSsm : public DSyntaxStateMachine<DIfElseSsm> {
public:
using Super = DSyntaxStateMachine<DIfElseSsm>;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using TypeDescr = xo::reflect::TypeDescr;
@ -167,6 +168,13 @@ namespace xo {
parserstatemachine * p_psm) override;
#endif
/** @defgroup scm-ifelsessm-gc-support gc support methods **/
///@{
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
#ifdef NOT_YET
static std::unique_ptr<if_else_xs> make();

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-difelsessm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DIfElseSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DIfElseSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DIfElseSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -59,6 +59,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DLambdaSsm>;
using DLocalSymtab = xo::scm::DLocalSymtab;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using TypeDescr = xo::reflect::TypeDescr;
@ -184,6 +185,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-lambdassm-gc-support gc support methods **/
///@{
/** gc support: visit gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dlambdassm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DLambdaSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DLambdaSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DLambdaSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -50,6 +50,7 @@ namespace xo {
public:
using Super = DSyntaxStateMachine<DParenSsm>;
using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
@ -131,6 +132,13 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-parenssm-gc-support gc support methods **/
///@{
/** gc support: visit immediate gc-aware children **/
void forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-parenssm-member-vars **/

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dparenssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DParenSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DParenSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DParenSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -1,4 +1,4 @@
/** @file SchematikaParser.hpp
/** @file DSchematikaParser.hpp
*
* @author Roland Conybeare, Jan 2026
**/
@ -151,13 +151,21 @@ namespace xo {
* | =>
* | >
*
* ----------------------------------------------------------------
* NOTES:
* - SchematikaParser partially supports the gcobject facet so it can be a collector root node.
* It's not actually moveable (since its ParserStateMachine member isn't moveable),
* Only the forward_children method is load-bearing.
*
**/
class SchematikaParser {
class DSchematikaParser {
public:
using token_type = Token;
using ArenaHashMapConfig = xo::map::ArenaHashMapConfig;
using ArenaConfig = xo::mm::ArenaConfig;
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using AGCObject = xo::mm::AGCObject;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using ppindentinfo = xo::print::ppindentinfo;
using size_type = std::size_t;
@ -173,12 +181,36 @@ namespace xo {
* with lifetime bounded by this
* SchematikeParser itself
**/
SchematikaParser(const ParserConfig & config,
obj<AAllocator> expr_alloc,
obj<AAllocator> aux_alloc);
DSchematikaParser(const ParserConfig & config,
obj<AAllocator> expr_alloc,
obj<AAllocator> aux_alloc);
/** non-trivial dtor because of @ref psm_ **/
~SchematikaParser() = default;
~DSchematikaParser() = default;
/** create parser in initial state.
*
* @p mm allocate SchematikaParser instance from here.
* (likely the same as aux_alloc)
* @p config parser configuration
* @p expr_alloc allocator for schematika expressions.
* Probably shared with execution.
* @p aux_alloc aux allocator for non-copyable memory
* with lifetime bounded by this
* SchematikeParser itself
**/
static DSchematikaParser * _make(obj<AAllocator> mm,
const ParserConfig & config,
obj<AAllocator> expr_alloc,
obj<AAllocator> aux_alloc);
/** like _make(mm,config,expr_alloc,aux_alloc),
* but as fop
**/
static obj<AGCObject,DSchematikaParser> make(obj<AAllocator> mm,
const ParserConfig & config,
obj<AAllocator> expr_alloc,
obj<AAllocator> aux_alloc);
/** scm-schematikaparser-access-methods **/
///@{
@ -248,7 +280,7 @@ namespace xo {
void reset_to_idle_toplevel();
///@}
/** scm-schematikaparser-pretty-methods **/
/** @defgroup scm-schematikaparser-pretty-methods **/
///@{
/** print human-readable representation on stream @p os **/
@ -257,18 +289,32 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const;
///@}
/** @defgroup scm-schematikaparser-gcobject-methods **/
///@{
std::size_t shallow_size() const noexcept;
/** not implemented (SchematikaParser not designed to be copyable) **/
DSchematikaParser * shallow_copy(obj<AAllocator> mm) const noexcept;
/** forward gc-aware children **/
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}
private:
/** @defgroup scm-schematikaparser-member-variables member variables **/
///@{
/** state machine **/
ParserStateMachine psm_;
/** debug flag (also stored in psm_) **/
bool debug_flag_ = false;
}; /*SchematikaParser*/
///@}
}; /*DSchematikaParser*/
inline std::ostream &
operator<< (std::ostream & os,
const SchematikaParser * x) {
const DSchematikaParser * x) {
if (x) {
x->print(os);
} else {
@ -284,8 +330,8 @@ namespace xo {
* to handle ParserResult instances
**/
template <>
struct ppdetail<xo::scm::SchematikaParser*> {
static inline bool print_pretty(const ppindentinfo & ppii, const xo::scm::SchematikaParser* p) {
struct ppdetail<xo::scm::DSchematikaParser*> {
static inline bool print_pretty(const ppindentinfo & ppii, const xo::scm::DSchematikaParser* p) {
if (p)
return p->pretty(ppii);
else
@ -295,4 +341,4 @@ namespace xo {
}
} /*namespace xo*/
/* end SchematikaParser.hpp */
/* end DSchematikaParser.hpp */

View file

@ -19,11 +19,12 @@
#include <xo/type/Type.hpp>
#include <xo/tokenizer2/Token.hpp>
#include <xo/reflect/TypeDescr.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/facet/obj.hpp>
#include <xo/facet/facet_implementation.hpp>
#include <xo/facet/typeseq.hpp>
// {pretex} here
// {pretext} here
namespace xo {
namespace scm {
@ -45,6 +46,8 @@ public:
using Opaque = void *;
/** reflected c++ type **/
using TypeDescr = xo::reflect::TypeDescr;
/** gc interface **/
using ACollector = xo::mm::ACollector;
/** gc-aware object **/
using AGCObject = xo::mm::AGCObject;
///@}
@ -52,6 +55,11 @@ public:
/** @defgroup scm-syntaxstatemachine-methods **/
///@{
// const methods
/** An uninitialized ASyntaxStateMachine instance will have zero vtable pointer (per {linux,osx} abi).
* Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example
* obj<AFacet> will have non-null vtable (via IFacet_Any) with all methods terminating.
**/
bool _has_null_vptr() const noexcept { return *reinterpret_cast<const void * const *>(this) == nullptr; }
/** RTTI: unique id# for actual runtime data representation **/
virtual typeseq _typeseq() const noexcept = 0;
/** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/
@ -82,6 +90,8 @@ public:
virtual void on_parsed_expression_with_token(Opaque data, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm) = 0;
/** update state machine for nested quoted literal @p lit **/
virtual void on_quoted_literal(Opaque data, obj<AGCObject> lit, ParserStateMachine * p_psm) = 0;
/** gc support: move immediate children to to-space and sub forwarding pointer **/
virtual void forward_children(Opaque data, obj<ACollector> gc) = 0;
///@}
}; /*ASyntaxStateMachine*/

View file

@ -45,6 +45,7 @@ namespace scm {
/** integer identifying a type **/
using typeseq = xo::facet::typeseq;
using TypeDescr = ASyntaxStateMachine::TypeDescr;
using ACollector = ASyntaxStateMachine::ACollector;
using AGCObject = ASyntaxStateMachine::AGCObject;
///@}
@ -74,6 +75,7 @@ namespace scm {
[[noreturn]] void on_parsed_expression(Opaque, obj<AExpression>, ParserStateMachine *) override;
[[noreturn]] void on_parsed_expression_with_token(Opaque, obj<AExpression>, const Token &, ParserStateMachine *) override;
[[noreturn]] void on_quoted_literal(Opaque, obj<AGCObject>, ParserStateMachine *) override;
[[noreturn]] void forward_children(Opaque, obj<ACollector>) override;
///@}

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-ddefinessm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DDefineSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DDefineSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DDefineSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectexprssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectExprSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectExprSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectExprSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectformalarglistssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectFormalArglistSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectFormalArglistSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectFormalArglistSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectqarrayssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectQArraySsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectQArraySsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectQArraySsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectqlistssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectQListSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectQListSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectQListSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectqliteralssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectQLiteralSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectQLiteralSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectQLiteralSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpectsymbolssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectSymbolSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectSymbolSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectSymbolSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dexpecttypessm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DExpectTypeSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DExpectTypeSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DExpectTypeSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dprogressssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DProgressSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DProgressSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DProgressSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dquotessm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DQuoteSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DQuoteSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DQuoteSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dsequencessm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DSequenceSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DSequenceSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DSequenceSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -42,6 +42,7 @@ namespace xo {
/** @defgroup scm-syntaxstatemachine-dtoplevelseqssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using ACollector = xo::scm::ASyntaxStateMachine::ACollector;
using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
@ -75,6 +76,8 @@ namespace xo {
static void on_parsed_expression_with_token(DToplevelSeqSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for nested quoted literal @p lit **/
static void on_quoted_literal(DToplevelSeqSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm);
/** gc support: move immediate children to to-space and sub forwarding pointer **/
static void forward_children(DToplevelSeqSsm & self, obj<ACollector> gc);
///@}
};

View file

@ -18,6 +18,7 @@
#include <xo/type/Type.hpp>
#include <xo/tokenizer2/Token.hpp>
#include <xo/reflect/TypeDescr.hpp>
#include <xo/alloc2/Collector.hpp>
namespace xo {
namespace scm {
@ -33,6 +34,7 @@ namespace scm {
/** integer identifying a type **/
using typeseq = ASyntaxStateMachine::typeseq;
using TypeDescr = ASyntaxStateMachine::TypeDescr;
using ACollector = ASyntaxStateMachine::ACollector;
using AGCObject = ASyntaxStateMachine::AGCObject;
///@}
@ -87,6 +89,9 @@ namespace scm {
void on_quoted_literal(Opaque data, obj<AGCObject> lit, ParserStateMachine * p_psm) override {
return I::on_quoted_literal(_dcast(data), lit, p_psm);
}
void forward_children(Opaque data, obj<ACollector> gc) override {
return I::forward_children(_dcast(data), gc);
}
///@}

View file

@ -32,6 +32,7 @@ public:
using DataPtr = Object::DataPtr;
using typeseq = xo::reflect::typeseq;
using TypeDescr = ASyntaxStateMachine::TypeDescr;
using ACollector = ASyntaxStateMachine::ACollector;
using AGCObject = ASyntaxStateMachine::AGCObject;
///@}
@ -92,6 +93,9 @@ public:
void on_quoted_literal(obj<AGCObject> lit, ParserStateMachine * p_psm) {
return O::iface()->on_quoted_literal(O::data(), lit, p_psm);
}
void forward_children(obj<ACollector> gc) {
return O::iface()->forward_children(O::data(), gc);
}
///@}
/** @defgroup scm-syntaxstatemachine-member-vars **/