aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/AbstractSyntaxTree.hpp
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2024-07-22 19:30:41 +0200
committer GitHub <noreply@github.com>2024-07-22 19:30:41 +0200
commit847280022ec8afb35d7d8639afd639c5ec42e3c7 (patch)
treee43aae271fe5aa75f1b0c918c1428e7f766a14f8 /src/openvic-dataloader/AbstractSyntaxTree.hpp
parentba8addc72595607206da654bc79c994121b7a3ae (diff)
parenta07c64148eb60b886f92caa46a9c687240ec420c (diff)
Merge pull request #52 from OpenVicProject/add/backslash-identifier
Add backslash identifier support to v2script
Diffstat (limited to 'src/openvic-dataloader/AbstractSyntaxTree.hpp')
-rw-r--r--src/openvic-dataloader/AbstractSyntaxTree.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/openvic-dataloader/AbstractSyntaxTree.hpp b/src/openvic-dataloader/AbstractSyntaxTree.hpp
index ade1c82..f9f5796 100644
--- a/src/openvic-dataloader/AbstractSyntaxTree.hpp
+++ b/src/openvic-dataloader/AbstractSyntaxTree.hpp
@@ -3,6 +3,7 @@
#include <concepts>
#include <cstdio>
#include <string_view>
+#include <type_traits>
#include <utility>
#include <openvic-dataloader/NodeLocation.hpp>
@@ -51,12 +52,12 @@ namespace ovdl {
using node_type = typename file_type::node_type;
explicit BasicAbstractSyntaxTree(file_type&& file)
- : AbstractSyntaxTree(file.size()),
+ : AbstractSyntaxTree(file.size() * file.visit_buffer([](auto&& buffer) -> size_t { return sizeof(typename std::decay_t<decltype(buffer)>::char_type); })),
_file { std::move(file) } {}
template<typename Encoding, typename MemoryResource = void>
explicit BasicAbstractSyntaxTree(lexy::buffer<Encoding, MemoryResource>&& buffer)
- : AbstractSyntaxTree(buffer.size()),
+ : AbstractSyntaxTree(buffer.size() * sizeof(Encoding::char_type)),
_file { std::move(buffer) } {}
void set_location(const node_type* n, NodeLocation loc) {