From 458180da5e61887cd9f820e573f307d0a640128d Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Sat, 11 May 2024 14:37:50 -0400 Subject: Fix bugs in #37 Fix error handling dropping errors Fix error handling segfaults Improve error messages --- src/openvic-dataloader/detail/Parser.cpp | 7 +++++++ src/openvic-dataloader/detail/dsl.hpp | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/openvic-dataloader/detail') diff --git a/src/openvic-dataloader/detail/Parser.cpp b/src/openvic-dataloader/detail/Parser.cpp index fd87687..bb5c612 100644 --- a/src/openvic-dataloader/detail/Parser.cpp +++ b/src/openvic-dataloader/detail/Parser.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -40,4 +41,10 @@ bool BasicParser::has_warning() const { std::string_view BasicParser::get_file_path() const { return _file_path; +} + +void BasicParser::set_file_path(std::string_view path) { + std::error_code error; + std::filesystem::path file_path = std::filesystem::weakly_canonical(path, error); + _file_path = file_path.string(); } \ No newline at end of file diff --git a/src/openvic-dataloader/detail/dsl.hpp b/src/openvic-dataloader/detail/dsl.hpp index 9b544bc..ccc1af6 100644 --- a/src/openvic-dataloader/detail/dsl.hpp +++ b/src/openvic-dataloader/detail/dsl.hpp @@ -97,14 +97,14 @@ namespace ovdl::dsl { template< IsParseState ParseType, - typename Identifier, + auto Identifier, typename RuleValue, ovdl::detail::string_literal Keyword, auto Production, auto Value> struct keyword_rule { struct rule_t { - static constexpr auto keyword = ovdl::dsl::keyword(lexy::dsl::inline_); + static constexpr auto keyword = ovdl::dsl::keyword(Identifier); static constexpr auto rule = lexy::dsl::position(keyword) >> lexy::dsl::equal_sign; static constexpr auto value = Value; }; @@ -114,7 +114,7 @@ namespace ovdl::dsl { template< IsParseState ParseType, - typename Identifier, + auto Identifier, typename RuleValue, ovdl::detail::string_literal Keyword, auto Production, -- cgit v1.2.3-56-ga3b1