aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/DiagnosticLogger.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/DiagnosticLogger.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/DiagnosticLogger.hpp')
-rw-r--r--src/openvic-dataloader/DiagnosticLogger.hpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/openvic-dataloader/DiagnosticLogger.hpp b/src/openvic-dataloader/DiagnosticLogger.hpp
index 2a655a9..9810e1e 100644
--- a/src/openvic-dataloader/DiagnosticLogger.hpp
+++ b/src/openvic-dataloader/DiagnosticLogger.hpp
@@ -19,6 +19,7 @@
#include <lexy/input/base.hpp>
#include <lexy/input/buffer.hpp>
#include <lexy/input_location.hpp>
+#include <lexy/lexeme.hpp>
#include <lexy/visualize.hpp>
#include <dryad/_detail/config.hpp>
@@ -36,7 +37,12 @@ namespace ovdl {
template<typename ParseState>
struct BasicDiagnosticLogger;
- struct DiagnosticLogger : SymbolIntern {
+ struct DiagnosticLogger {
+ struct SymbolId;
+ using index_type = std::uint32_t;
+ using symbol_type = dryad::symbol<SymbolId, index_type>;
+ using symbol_interner_type = dryad::symbol_interner<SymbolId, char, index_type>;
+
using AnnotationKind = lexy_ext::annotation_kind;
using DiagnosticKind = lexy_ext::diagnostic_kind;
@@ -200,6 +206,15 @@ namespace ovdl {
const symbol_interner_type& symbol_interner() const {
return _symbol_interner;
}
+
+ template<typename Reader>
+ symbol_type intern(lexy::lexeme<Reader> lexeme) {
+ return intern(lexeme.data(), lexeme.size());
+ }
+ template<typename Reader>
+ const char* intern_cstr(lexy::lexeme<Reader> lexeme) {
+ return intern_cstr(lexeme.data(), lexeme.size());
+ }
};
template<typename ParseState>