diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-09-14 08:39:44 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-09-29 02:15:46 +0200 |
commit | 70ee2cea9bf1c752bcb3f1e0bd9e7b00f437967e (patch) | |
tree | 384e326485b8b19816b567515a34fe6db66a7f8d /src/openvic-dataloader/csv/Parser.cpp | |
parent | 5afe363e7f48ee52fd70edea316789fcb18178dc (diff) |
Add parse state escape behavior
Diffstat (limited to 'src/openvic-dataloader/csv/Parser.cpp')
-rw-r--r-- | src/openvic-dataloader/csv/Parser.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/openvic-dataloader/csv/Parser.cpp b/src/openvic-dataloader/csv/Parser.cpp index 14ef553..40f0037 100644 --- a/src/openvic-dataloader/csv/Parser.cpp +++ b/src/openvic-dataloader/csv/Parser.cpp @@ -38,9 +38,9 @@ struct LexyEncodingFrom<EncodingType::Utf8> { template<EncodingType Encoding> class Parser<Encoding>::BufferHandler final : public detail::BasicBufferHandler<typename LexyEncodingFrom<Encoding>::encoding> { public: - template<typename Node, typename ErrorCallback> - std::optional<std::vector<ParseError>> parse(const ErrorCallback& callback) { - auto result = lexy::parse<Node>(this->_buffer, callback); + template<typename Node, typename ParseState, typename ErrorCallback> + std::optional<std::vector<ParseError>> parse(const ParseState& state, const ErrorCallback& callback) { + auto result = lexy::parse<Node>(this->_buffer, state, callback); if (!result) { return result.errors(); } @@ -174,14 +174,14 @@ bool Parser<Encoding>::parse_csv(bool handle_strings) { auto report_error = ovdl::detail::ReporError.path(_file_path).to(detail::OStreamOutputIterator { _error_stream }); if constexpr (Encoding == EncodingType::Windows1252) { if (handle_strings) - errors = _buffer_handler->template parse<csv::grammar::windows1252::strings::SemiColonFile>(report_error); + errors = _buffer_handler->template parse<csv::grammar::windows1252::strings::SemiColonFile>(_parser_state, report_error); else - errors = _buffer_handler->template parse<csv::grammar::windows1252::SemiColonFile>(report_error); + errors = _buffer_handler->template parse<csv::grammar::windows1252::SemiColonFile>(_parser_state, report_error); } else { if (handle_strings) - errors = _buffer_handler->template parse<csv::grammar::utf8::strings::SemiColonFile>(report_error); + errors = _buffer_handler->template parse<csv::grammar::utf8::strings::SemiColonFile>(_parser_state, report_error); else - errors = _buffer_handler->template parse<csv::grammar::utf8::SemiColonFile>(report_error); + errors = _buffer_handler->template parse<csv::grammar::utf8::SemiColonFile>(_parser_state, report_error); } if (errors) { _errors.reserve(errors->size()); |