From 7b8e864668c0fa6c40cde7f4ca18cdbab3e99817 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 01:27:25 -0500 Subject: [PATCH] xo-interpreter2 stack: + stringtable() in RuntimeContext api --- include/xo/reader2/ParserStateMachine.hpp | 1 + include/xo/reader2/SchematikaParser.hpp | 1 + include/xo/reader2/SchematikaReader.hpp | 3 +++ src/reader2/SchematikaReader.cpp | 6 ++++++ 4 files changed, 11 insertions(+) diff --git a/include/xo/reader2/ParserStateMachine.hpp b/include/xo/reader2/ParserStateMachine.hpp index a7726c35..2ea90466 100644 --- a/include/xo/reader2/ParserStateMachine.hpp +++ b/include/xo/reader2/ParserStateMachine.hpp @@ -88,6 +88,7 @@ namespace xo { bool debug_flag() const noexcept { return debug_flag_; } ParserStack * stack() const noexcept { return stack_; } obj 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_; } DGlobalEnv * global_env() const noexcept { return global_env_.data(); } diff --git a/include/xo/reader2/SchematikaParser.hpp b/include/xo/reader2/SchematikaParser.hpp index dd6ae341..ce83dd8a 100644 --- a/include/xo/reader2/SchematikaParser.hpp +++ b/include/xo/reader2/SchematikaParser.hpp @@ -185,6 +185,7 @@ namespace xo { DGlobalSymtab * global_symtab() const noexcept; DGlobalEnv * global_env() const noexcept; + StringTable * stringtable() noexcept { return psm_.stringtable(); } bool debug_flag() const { return debug_flag_; } diff --git a/include/xo/reader2/SchematikaReader.hpp b/include/xo/reader2/SchematikaReader.hpp index 0761b6e3..8b24f775 100644 --- a/include/xo/reader2/SchematikaReader.hpp +++ b/include/xo/reader2/SchematikaReader.hpp @@ -60,6 +60,9 @@ namespace xo { /** top-level global environment (e.g. contains built-in primitives) **/ DGlobalEnv * global_env() const noexcept; + /** global unique-string table **/ + StringTable * stringtable() noexcept; + /** visit reader-owned memory pools; call visitor(info) for each. * Specifically exclude expr_alloc, since we don't consider * that reader-owned diff --git a/src/reader2/SchematikaReader.cpp b/src/reader2/SchematikaReader.cpp index de815f97..388c5266 100644 --- a/src/reader2/SchematikaReader.cpp +++ b/src/reader2/SchematikaReader.cpp @@ -38,6 +38,12 @@ namespace xo { return parser_.global_env(); } + StringTable * + SchematikaReader::stringtable() noexcept + { + return parser_.stringtable(); + } + void SchematikaReader::visit_pools(const MemorySizeVisitor & visitor) const {