aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/detail/InternalConcepts.hpp
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2024-07-05 22:30:32 +0200
committer GitHub <noreply@github.com>2024-07-05 22:30:32 +0200
commit4a49007492152037bc1e9636b024cc67700e9dae (patch)
tree457b7fbda6d4470465c05d59b0ca51ed30628640 /src/openvic-dataloader/detail/InternalConcepts.hpp
parentdeed8ec0ae23651529a58125012c1b4aab015d02 (diff)
parent3eb78b27505b602c1ccfa952c4cc00f942ccb2b9 (diff)
Merge pull request #50 from OpenVicProject/simplify-string-interning
Fix string interning pointer invalidity for AST
Diffstat (limited to 'src/openvic-dataloader/detail/InternalConcepts.hpp')
-rw-r--r--src/openvic-dataloader/detail/InternalConcepts.hpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/openvic-dataloader/detail/InternalConcepts.hpp b/src/openvic-dataloader/detail/InternalConcepts.hpp
index 0c7913d..06c03a1 100644
--- a/src/openvic-dataloader/detail/InternalConcepts.hpp
+++ b/src/openvic-dataloader/detail/InternalConcepts.hpp
@@ -6,10 +6,13 @@
#include <openvic-dataloader/NodeLocation.hpp>
#include <openvic-dataloader/detail/Encoding.hpp>
#include <openvic-dataloader/detail/SymbolIntern.hpp>
+#include <openvic-dataloader/detail/Utility.hpp>
#include <lexy/encoding.hpp>
#include <lexy/input/buffer.hpp>
+#include <dryad/symbol.hpp>
+
#include <fmt/core.h>
#include <lexy_ext/report_error.hpp>
@@ -17,8 +20,9 @@
namespace ovdl::detail {
template<typename T>
concept IsFile =
- requires(T t, const typename T::node_type* node, NodeLocation location) {
+ requires(T t, const T ct, const typename T::node_type* node, NodeLocation location) {
typename T::node_type;
+ { ct.size() } -> std::same_as<size_t>;
{ t.set_location(node, location) } -> std::same_as<void>;
{ t.location_of(node) } -> std::same_as<NodeLocation>;
};
@@ -58,12 +62,12 @@ namespace ovdl::detail {
{ ct.errored() } -> std::same_as<bool>;
{ ct.warned() } -> std::same_as<bool>;
{ ct.get_errors() } -> std::same_as<typename T::error_range>;
- { t.intern(str, length) } -> std::same_as<ovdl::SymbolIntern::symbol_type>;
- { t.intern(sv) } -> std::same_as<ovdl::SymbolIntern::symbol_type>;
+ { t.intern(str, length) } -> detail::InstanceOf<dryad::symbol>;
+ { t.intern(sv) } -> detail::InstanceOf<dryad::symbol>;
{ t.intern_cstr(str, length) } -> std::same_as<const char*>;
{ t.intern_cstr(sv) } -> std::same_as<const char*>;
- { t.symbol_interner() } -> std::same_as<SymbolIntern::symbol_interner_type&>;
- { ct.symbol_interner() } -> std::same_as<const SymbolIntern::symbol_interner_type&>;
+ { t.symbol_interner() } -> detail::InstanceOf<dryad::symbol_interner>;
+ { ct.symbol_interner() } -> detail::InstanceOf<dryad::symbol_interner>;
{ t.error(std::declval<typename T::template format_str<>>()) } -> std::same_as<typename T::Writer>;
{ t.warning(std::declval<typename T::template format_str<>>()) } -> std::same_as<typename T::Writer>;
{ t.note(std::declval<typename T::template format_str<>>()) } -> std::same_as<typename T::Writer>;