diff options
author | Hop311 <Hop3114@gmail.com> | 2023-12-11 09:17:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 09:17:50 +0100 |
commit | 97371b2d7550f143dfd5b1c3bba088fc98012332 (patch) | |
tree | 6bc17cfd188c7e18b8e3a51fc07e3d8071d360f6 | |
parent | ce1f1e5fe32ed0856bd2b6df5136dad3f6bc9918 (diff) | |
parent | 8cd7b25b3eb87efdf56e5f87de928b93ed4fb2ed (diff) |
Merge pull request #32 from OpenVicProject/csv-newline-fix
Fix early termination on newline in CSV file
-rw-r--r-- | src/openvic-dataloader/csv/CsvGrammar.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/openvic-dataloader/csv/CsvGrammar.hpp b/src/openvic-dataloader/csv/CsvGrammar.hpp index aef513b..712bddc 100644 --- a/src/openvic-dataloader/csv/CsvGrammar.hpp +++ b/src/openvic-dataloader/csv/CsvGrammar.hpp @@ -165,9 +165,9 @@ namespace ovdl::csv::grammar { template<ParseOptions Options> struct File { - static constexpr auto rule = - lexy::dsl::whitespace(lexy::dsl::newline) + - lexy::dsl::opt(lexy::dsl::list(lexy::dsl::p<Line<Options>>, lexy::dsl::trailing_sep(lexy::dsl::eol))); + static constexpr auto rule = lexy::dsl::terminator(lexy::dsl::eof).opt_list( + lexy::dsl::p<Line<Options>> | lexy::dsl::newline + ); static constexpr auto value = lexy::as_list<std::vector<ovdl::csv::LineObject>>; }; |