diff --git a/include/xo/interpreter2/DVsmRcx.hpp b/include/xo/interpreter2/DVsmRcx.hpp index 3323f7d7..1f3a8f57 100644 --- a/include/xo/interpreter2/DVsmRcx.hpp +++ b/include/xo/interpreter2/DVsmRcx.hpp @@ -5,6 +5,7 @@ #pragma once +#include #include #include @@ -19,6 +20,7 @@ namespace xo { **/ class DVsmRcx { public: + using StringTable = xo::scm::StringTable; using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; @@ -26,6 +28,7 @@ namespace xo { DVsmRcx(VirtualSchematikaMachine * vsm); obj allocator() const noexcept; + StringTable * stringtable() const noexcept; obj error_allocator() const noexcept; void visit_pools(const MemorySizeVisitor & visitor) const; diff --git a/include/xo/interpreter2/VirtualSchematikaMachine.hpp b/include/xo/interpreter2/VirtualSchematikaMachine.hpp index 290eaf09..382dbc5d 100644 --- a/include/xo/interpreter2/VirtualSchematikaMachine.hpp +++ b/include/xo/interpreter2/VirtualSchematikaMachine.hpp @@ -91,6 +91,8 @@ namespace xo { obj allocator() const noexcept; /** allocator for runtime errors **/ obj error_allocator() const noexcept; + /** global unique-string table **/ + StringTable * stringtable() noexcept; /** true iff parser is at top-level -> does not contain * state for a incomplete/partial expression diff --git a/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp b/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp index 0305e3e5..1b4c1567 100644 --- a/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp +++ b/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp @@ -49,6 +49,8 @@ namespace xo { // const methods /** default allocator to use for objects **/ static obj allocator(const DVsmRcx & self) noexcept; + /** stringtable for unique symbols **/ + static StringTable * stringtable(const DVsmRcx & self) noexcept; /** invoke visitor for each distinct memory pool **/ static void visit_pools(const DVsmRcx & self, MemorySizeVisitor visitor); diff --git a/src/interpreter2/DVsmRcx.cpp b/src/interpreter2/DVsmRcx.cpp index fa81b9c8..b7ea4112 100644 --- a/src/interpreter2/DVsmRcx.cpp +++ b/src/interpreter2/DVsmRcx.cpp @@ -25,6 +25,12 @@ namespace xo { return vsm_->error_allocator(); } + StringTable * + DVsmRcx::stringtable() const noexcept + { + return vsm_->stringtable(); + } + void DVsmRcx::visit_pools(const MemorySizeVisitor & visitor) const { diff --git a/src/interpreter2/IRuntimeContext_DVsmRcx.cpp b/src/interpreter2/IRuntimeContext_DVsmRcx.cpp index d201051a..e879d4ed 100644 --- a/src/interpreter2/IRuntimeContext_DVsmRcx.cpp +++ b/src/interpreter2/IRuntimeContext_DVsmRcx.cpp @@ -21,6 +21,12 @@ namespace xo { return self.allocator(); } + auto + IRuntimeContext_DVsmRcx::stringtable(const DVsmRcx & self) noexcept -> StringTable * + { + return self.stringtable(); + } + auto IRuntimeContext_DVsmRcx::visit_pools(const DVsmRcx & self, MemorySizeVisitor visitor) -> void { diff --git a/src/interpreter2/VirtualSchematikaMachine.cpp b/src/interpreter2/VirtualSchematikaMachine.cpp index d459622a..5633c7d0 100644 --- a/src/interpreter2/VirtualSchematikaMachine.cpp +++ b/src/interpreter2/VirtualSchematikaMachine.cpp @@ -100,6 +100,12 @@ namespace xo { return error_mm_.to_op(); } + StringTable * + VirtualSchematikaMachine::stringtable() noexcept + { + return reader_.stringtable(); + } + bool VirtualSchematikaMachine::is_at_toplevel() const noexcept {