aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/v2script/Parser.cpp
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/v2script/Parser.cpp
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/v2script/Parser.cpp')
-rw-r--r--src/openvic-dataloader/v2script/Parser.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/openvic-dataloader/v2script/Parser.cpp b/src/openvic-dataloader/v2script/Parser.cpp
index 2375a1a..e5234d6 100644
--- a/src/openvic-dataloader/v2script/Parser.cpp
+++ b/src/openvic-dataloader/v2script/Parser.cpp
@@ -320,6 +320,10 @@ Parser::error_range Parser::get_errors() const {
return _parse_handler->get_errors();
}
+std::string_view Parser::error(const ovdl::error::Error* error) const {
+ return error->message(_parse_handler->parse_state().logger().symbol_interner());
+}
+
const FilePosition Parser::get_error_position(const error::Error* error) const {
if (!error || !error->is_linked_in_tree()) {
return {};
@@ -352,20 +356,20 @@ void Parser::print_errors_to(std::basic_ostream<char>& stream) const {
dryad::visit_tree(
error,
[&](const error::BufferError* buffer_error) {
- stream << "buffer error: " << buffer_error->message() << '\n';
+ stream << "buffer error: " << this->error(buffer_error) << '\n';
},
[&](dryad::child_visitor<error::ErrorKind> visitor, const error::AnnotatedError* annotated_error) {
- stream << annotated_error->message() << '\n';
+ stream << this->error(annotated_error) << '\n';
auto annotations = annotated_error->annotations();
for (auto annotation : annotations) {
visitor(annotation);
}
},
[&](const error::PrimaryAnnotation* primary) {
- stream << primary->message() << '\n';
+ stream << this->error(primary) << '\n';
},
[&](const error::SecondaryAnnotation* secondary) {
- stream << secondary->message() << '\n';
+ stream << this->error(secondary) << '\n';
});
}
} \ No newline at end of file