From 5bb97b985ecd02d6fe00ac93f47064d0eb16ce9f Mon Sep 17 00:00:00 2001 From: Daniel Parker Date: Tue, 12 Nov 2024 20:45:35 -0500 Subject: [PATCH] json_parser update -> set_buffer --- doc/ref/corelib/basic_json_parser.md | 42 +++++++------- doc/ref/corelib/basic_json_reader.md | 44 +++++++------- doc/ref/corelib/basic_parser_input.md | 11 ++++ doc/ref/deprecated.md | 5 +- examples/src/json_parser_examples.cpp | 8 ++- include/jsoncons/basic_json.hpp | 6 +- include/jsoncons/json_parser.hpp | 15 ++++- include/jsoncons/json_reader.hpp | 57 ++++++++++--------- include/jsoncons/source.hpp | 2 +- include/jsoncons_ext/csv/csv_parser.hpp | 15 +++-- .../jsoncons_ext/jsonpath/jsonpath_parser.hpp | 6 +- test/corelib/src/json_parser_tests.cpp | 28 ++++----- test/csv/src/csv_cursor_tests.cpp | 4 +- 13 files changed, 138 insertions(+), 105 deletions(-) create mode 100644 doc/ref/corelib/basic_parser_input.md diff --git a/doc/ref/corelib/basic_json_parser.md b/doc/ref/corelib/basic_json_parser.md index c31e45808..ae75594df 100644 --- a/doc/ref/corelib/basic_json_parser.md +++ b/doc/ref/corelib/basic_json_parser.md @@ -13,24 +13,6 @@ A `basic_json_parser` is an incremental json parser. It can be fed its input in chunks, and does not require an entire file to be loaded in memory at one time. -A buffer of text is supplied to the parser with a call to `update(buffer)`. -If a subsequent call to `parse_some` reaches the end of the buffer in the middle of parsing, -say after digesting the sequence 'f', 'a', 'l', member function `stopped()` will return `false` -and `source_exhausted()` will return `true`. Additional JSON text can be supplied to the parser, -`parse_some` called again, and parsing will resume from where it left off. - -A typical application will repeatedly call the `parse_some` function -until `stopped()` returns true. A stopped state indicates that a content -visitor function returned `false`, an error occured, or a complete JSON -text has been consumed. If the latter, `done() `will return `true`. - -As an alternative to repeatedly calling `parse_some()` until `stopped()` -returns `true`, when `source_exhausted()` is `true` and there is -no more input, `finish_parse` may be called. - -`check_done` can be called to check if the input has any unconsumed -non-whitespace characters, which would normally be considered an error. - `basic_json_parser` is used by the push parser [basic_json_reader](basic_json_reader.md), and by the pull parser [basic_json_cursor](basic_json_cursor.md). @@ -79,14 +61,15 @@ and a specified [err_handler](err_handler.md). (4) Constructs a `json_parser` that uses the specified [basic_json_options](basic_json_options.md) and a specified [err_handler](err_handler.md). -Note: It is the programmer's responsibility to ensure that a `basic_json_parser` does not outlive any string passed in the constuctor. - #### Member functions - void update(const string_view_type& sv) - void update(const char* data, std::size_t length) + void update(const string_view_type& sv) + void update(const CharT* data, std::size_t length) (deprecated in 0.179.0) Update the parser with a chunk of JSON + void set_buffer(const CharT* data, std::size_t length) final (since 0.179.0) +Initializes the buffer to parse from with a chunk of JSON text + bool done() const Returns `true` when the parser has consumed a complete JSON text, `false` otherwise @@ -247,6 +230,19 @@ int main() Output: ``` +(1) done: false, source_exhausted: true + +(2) done: false, source_exhausted: true + +(3) done: false, source_exhausted: true + +(4) done: false, source_exhausted: true + +(5) done: true, source_exhausted: true + +(6) done: true, source_exhausted: true + +(7) [false,90] ``` #### Incremental parsing (since 0.179.0) @@ -264,7 +260,7 @@ int main() { if (index < chunks.size()) { - input.update(chunks[index].data(), chunks[index].size()); + input.set_buffer(chunks[index].data(), chunks[index].size()); ++index; return true; } diff --git a/doc/ref/corelib/basic_json_reader.md b/doc/ref/corelib/basic_json_reader.md index b5e2cbbcc..f8a8a2113 100644 --- a/doc/ref/corelib/basic_json_reader.md +++ b/doc/ref/corelib/basic_json_reader.md @@ -39,48 +39,48 @@ string_view_type | #### Constructors template - explicit basic_json_reader(Sourceable&& source, - const TempAllocator& alloc = TempAllocator()); (1) + explicit basic_json_reader(Sourceable&& source, (1) + const TempAllocator& alloc = TempAllocator()); template basic_json_reader(Sourceable&& source, - const basic_json_options& options, - const TempAllocator& alloc = TempAllocator()); (2) + const basic_json_options& options, + const TempAllocator& alloc = TempAllocator()); (2) template basic_json_reader(Sourceable&& source, - std::function err_handler, - const TempAllocator& alloc = TempAllocator()); (3) + std::function err_handler, (3) (deprecated in 0.171.0) + const TempAllocator& alloc = TempAllocator()); template basic_json_reader(Sourceable&& source, - const basic_json_options& options, - std::function err_handler, - const TempAllocator& alloc = TempAllocator()); (4) + const basic_json_options& options, (4) (deprecated in 0.171.0) + std::function err_handler, + const TempAllocator& alloc = TempAllocator()); template - basic_json_reader(Sourceable&& source, - basic_json_visitor& visitor, - const TempAllocator& alloc = TempAllocator()); (5) + basic_json_reader(Sourceable&& source, (5) + basic_json_visitor& visitor, + const TempAllocator& alloc = TempAllocator()); template basic_json_reader(Sourceable&& source, - basic_json_visitor& visitor, - const basic_json_options& options, - const TempAllocator& alloc = TempAllocator()); (6) + basic_json_visitor& visitor, (6) + const basic_json_options& options, + const TempAllocator& alloc = TempAllocator()); template basic_json_reader(Sourceable&& source, - basic_json_visitor& visitor, - std::function err_handler, - const TempAllocator& alloc = TempAllocator()); (7) + basic_json_visitor& visitor, (7) (deprecated in 0.171.0) + std::function err_handler, + const TempAllocator& alloc = TempAllocator()); template basic_json_reader(Sourceable&& source, - basic_json_visitor& visitor, - const basic_json_options& options, - std::function err_handler, - const TempAllocator& alloc = TempAllocator()); (8) + basic_json_visitor& visitor, (8) (deprecated in 0.171.0) + const basic_json_options& options, + std::function err_handler, + const TempAllocator& alloc = TempAllocator()); Constructors (1)-(4) use a default [basic_json_visitor](basic_json_visitor.md) that discards the JSON parse events, and are for validation only. diff --git a/doc/ref/corelib/basic_parser_input.md b/doc/ref/corelib/basic_parser_input.md new file mode 100644 index 000000000..dee484d99 --- /dev/null +++ b/doc/ref/corelib/basic_parser_input.md @@ -0,0 +1,11 @@ +### jsoncons::basic_parser_input + +```cpp +#include + +template +class basic_parser_input; +``` + + virtual void set_buffer(const CharT* data, std::size_t length) = 0; + diff --git a/doc/ref/deprecated.md b/doc/ref/deprecated.md index 26b415264..1e1dd9d3a 100644 --- a/doc/ref/deprecated.md +++ b/doc/ref/deprecated.md @@ -7,7 +7,10 @@ Category/class|Old name|Replacement __corelib__| |  `basic_json_parser`| |   |`basic_json_parser(std::function, const TempAllocator&`|Set error handler in options - |`basic_json_parser(const basic_json_decode_options&,std::function,`const TempAllocator&`|Set error handler in options + |`basic_json_parser(const basic_json_decode_options&,std::function, const TempAllocator&`|Set error handler in options + |`void update(string_view_type)`|Use `set_buffer` once or provide a chunk reader + |`void update(const char_type*, std::size_t)`|Use `set_buffer` once or provide a chunk reader +`basic_json_reader`| |  diff --git a/examples/src/json_parser_examples.cpp b/examples/src/json_parser_examples.cpp index 7b9b91b39..452560557 100644 --- a/examples/src/json_parser_examples.cpp +++ b/examples/src/json_parser_examples.cpp @@ -54,7 +54,7 @@ void incremental_parsing_example() { if (index < chunks.size()) { - input.update(chunks[index].data(), chunks[index].size()); + input.set_buffer(chunks[index].data(), chunks[index].size()); ++index; return true; } @@ -106,7 +106,11 @@ void parse_nan_replacement_example() jsoncons::json_parser parser(options); try { - parser.update(s); +#if JSONCONS_VERSION_MAJOR == 0 && JSONCONS_VERSION_MINOR < 179 + parser.update(s); // until 0.179.0 +#else + parser.set_buffer(s.data(), s.size()); // since 0.179.0 +#endif parser.parse_some(decoder); parser.finish_parse(decoder); parser.check_done(); diff --git a/include/jsoncons/basic_json.hpp b/include/jsoncons/basic_json.hpp index 3810ea079..c045977fe 100644 --- a/include/jsoncons/basic_json.hpp +++ b/include/jsoncons/basic_json.hpp @@ -1800,7 +1800,7 @@ namespace jsoncons { JSONCONS_THROW(ser_error(json_errc::illegal_unicode_character,parser.line(),parser.column())); } std::size_t offset = (r.ptr - source.data()); - parser.update(source.data()+offset,source.size()-offset); + parser.set_buffer(source.data()+offset,source.size()-offset); parser.parse_some(decoder); parser.finish_parse(decoder); parser.check_done(); @@ -1826,7 +1826,7 @@ namespace jsoncons { JSONCONS_THROW(ser_error(json_errc::illegal_unicode_character,parser.line(),parser.column())); } std::size_t offset = (r.ptr - source.data()); - parser.update(source.data()+offset,source.size()-offset); + parser.set_buffer(source.data()+offset,source.size()-offset); parser.parse_some(decoder); parser.finish_parse(decoder); parser.check_done(); @@ -1997,7 +1997,7 @@ namespace jsoncons { JSONCONS_THROW(ser_error(json_errc::illegal_unicode_character,parser.line(),parser.column())); } std::size_t offset = (r.ptr - source.data()); - parser.update(source.data()+offset,source.size()-offset); + parser.set_buffer(source.data()+offset,source.size()-offset); parser.parse_some(decoder); parser.finish_parse(decoder); parser.check_done(); diff --git a/include/jsoncons/json_parser.hpp b/include/jsoncons/json_parser.hpp index 072b806a6..ce6d1a953 100644 --- a/include/jsoncons/json_parser.hpp +++ b/include/jsoncons/json_parser.hpp @@ -559,12 +559,23 @@ class basic_json_parser : public ser_context, public virtual basic_parser_input< } } - void update(const string_view_type sv) +#if !defined(JSONCONS_NO_DEPRECATED) + JSONCONS_DEPRECATED_MSG("Instead, use set_buffer once or provide a chunk reader") + void update(string_view_type sv) { update(sv.data(),sv.length()); } - void update(const char_type* data, std::size_t length) final + JSONCONS_DEPRECATED_MSG("Instead, use set_buffer once or provide a chunk reader") + void update(const char_type* data, std::size_t length) + { + begin_input_ = data; + input_end_ = data + length; + input_ptr_ = begin_input_; + } +#endif + + void set_buffer(const char_type* data, std::size_t length) final { begin_input_ = data; input_end_ = data + length; diff --git a/include/jsoncons/json_reader.hpp b/include/jsoncons/json_reader.hpp index 067a3a2fe..604ec5372 100644 --- a/include/jsoncons/json_reader.hpp +++ b/include/jsoncons/json_reader.hpp @@ -32,7 +32,6 @@ namespace jsoncons { private: basic_default_json_visitor default_visitor_; basic_json_visitor& other_visitor_; - //std::function err_handler_; // noncopyable and nonmoveable json_utf8_to_other_visitor_adaptor(const json_utf8_to_other_visitor_adaptor&) = delete; @@ -44,10 +43,8 @@ namespace jsoncons { { } - json_utf8_to_other_visitor_adaptor(basic_json_visitor& other_visitor/*, - std::function err_handler*/) - : other_visitor_(other_visitor)/*, - err_handler_(err_handler)*/ + json_utf8_to_other_visitor_adaptor(basic_json_visitor& other_visitor) + : other_visitor_(other_visitor) { } @@ -194,56 +191,58 @@ namespace jsoncons { } template - basic_json_reader(Sourceable&& source, - std::function err_handler, + basic_json_reader(Sourceable&& source, + basic_json_visitor& visitor, const TempAllocator& temp_alloc = TempAllocator()) : basic_json_reader(std::forward(source), - default_visitor_, + visitor, basic_json_decode_options(), - err_handler, temp_alloc) { } template basic_json_reader(Sourceable&& source, - const basic_json_decode_options& options, - std::function err_handler, + basic_json_visitor& visitor, + const basic_json_decode_options& options, const TempAllocator& temp_alloc = TempAllocator()) - : basic_json_reader(std::forward(source), - default_visitor_, - options, - err_handler, - temp_alloc) + : source_(std::forward(source)), + visitor_(visitor), + parser_(this, options, options.err_handler(), temp_alloc), + eof_(false) { } +#if !defined(JSONCONS_NO_DEPRECATED) template - basic_json_reader(Sourceable&& source, - basic_json_visitor& visitor, + JSONCONS_DEPRECATED_MSG("Instead, set err_handler in options") + basic_json_reader(Sourceable&& source, + std::function err_handler, const TempAllocator& temp_alloc = TempAllocator()) : basic_json_reader(std::forward(source), - visitor, + default_visitor_, basic_json_decode_options(), - default_json_parsing(), + err_handler, temp_alloc) { } template + JSONCONS_DEPRECATED_MSG("Instead, set err_handler in options") basic_json_reader(Sourceable&& source, - basic_json_visitor& visitor, - const basic_json_decode_options& options, + const basic_json_decode_options& options, + std::function err_handler, const TempAllocator& temp_alloc = TempAllocator()) : basic_json_reader(std::forward(source), - visitor, + default_visitor_, options, - options.err_handler(), + err_handler, temp_alloc) { } template + JSONCONS_DEPRECATED_MSG("Instead, set err_handler in options") basic_json_reader(Sourceable&& source, basic_json_visitor& visitor, std::function err_handler, @@ -257,6 +256,7 @@ namespace jsoncons { } template + JSONCONS_DEPRECATED_MSG("Instead, set err_handler in options") basic_json_reader(Sourceable&& source, basic_json_visitor& visitor, const basic_json_decode_options& options, @@ -268,6 +268,7 @@ namespace jsoncons { eof_(false) { } +#endif bool read_chunk(basic_parser_input&, std::error_code& ec) final { @@ -277,7 +278,7 @@ namespace jsoncons { if (ec) return false; if (s.size() > 0) { - parser_.update(s.data(),s.size()); + parser_.set_buffer(s.data(),s.size()); success = true; } else @@ -310,7 +311,7 @@ namespace jsoncons { if (ec) return; if (s.size() > 0) { - parser_.update(s.data(),s.size()); + parser_.set_buffer(s.data(),s.size()); } parser_.parse_some(visitor_, ec); if (ec) return; @@ -329,7 +330,7 @@ namespace jsoncons { if (ec) return; if (s1.size() > 0) { - parser_.update(s1.data(),s1.size()); + parser_.set_buffer(s1.data(),s1.size()); } } else @@ -381,7 +382,7 @@ namespace jsoncons { if (ec) return; if (s.size() > 0) { - parser_.update(s.data(),s.size()); + parser_.set_buffer(s.data(),s.size()); } } if (!parser_.source_exhausted()) diff --git a/include/jsoncons/source.hpp b/include/jsoncons/source.hpp index 77961d7f4..0e8339044 100644 --- a/include/jsoncons/source.hpp +++ b/include/jsoncons/source.hpp @@ -796,7 +796,7 @@ class basic_parser_input using char_type = CharT; virtual ~basic_parser_input() = default; - virtual void update(const char_type* data, std::size_t length) = 0; + virtual void set_buffer(const CharT* data, std::size_t length) = 0; }; template diff --git a/include/jsoncons_ext/csv/csv_parser.hpp b/include/jsoncons_ext/csv/csv_parser.hpp index 7fbd20b44..d4644bba6 100644 --- a/include/jsoncons_ext/csv/csv_parser.hpp +++ b/include/jsoncons_ext/csv/csv_parser.hpp @@ -1310,6 +1310,13 @@ class basic_csv_parser : public ser_context input_ptr_ = begin_input_; } + void set_buffer(const CharT* data, std::size_t length) + { + begin_input_ = data; + input_end_ = data + length; + input_ptr_ = begin_input_; + } + std::size_t line() const override { return line_; @@ -1674,7 +1681,7 @@ class basic_csv_parser : public ser_context if (column_index_ - offset_ < column_defaults_.size() && column_defaults_[column_index_ - offset_].length() > 0) { basic_json_parser parser(alloc_); - parser.update(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); + parser.set_buffer(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); parser.parse_some(*visitor_); parser.finish_parse(*visitor_); } @@ -1705,7 +1712,7 @@ class basic_csv_parser : public ser_context if (column_index_ - offset_ < column_defaults_.size() && column_defaults_[column_index_ - offset_].length() > 0) { basic_json_parser parser(alloc_); - parser.update(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); + parser.set_buffer(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); parser.parse_some(*visitor_); parser.finish_parse(*visitor_); } @@ -1740,7 +1747,7 @@ class basic_csv_parser : public ser_context if (column_index_ - offset_ < column_defaults_.size() && column_defaults_[column_index_ - offset_].length() > 0) { basic_json_parser parser(alloc_); - parser.update(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); + parser.set_buffer(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); parser.parse_some(*visitor_); parser.finish_parse(*visitor_); } @@ -1761,7 +1768,7 @@ class basic_csv_parser : public ser_context if (column_index_ < column_defaults_.size() + offset_ && column_defaults_[column_index_ - offset_].length() > 0) { basic_json_parser parser(alloc_); - parser.update(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); + parser.set_buffer(column_defaults_[column_index_ - offset_].data(),column_defaults_[column_index_ - offset_].length()); parser.parse_some(*visitor_); parser.finish_parse(*visitor_); } diff --git a/include/jsoncons_ext/jsonpath/jsonpath_parser.hpp b/include/jsoncons_ext/jsonpath/jsonpath_parser.hpp index e79ca8b09..a5a727458 100644 --- a/include/jsoncons_ext/jsonpath/jsonpath_parser.hpp +++ b/include/jsoncons_ext/jsonpath/jsonpath_parser.hpp @@ -376,7 +376,7 @@ namespace detail { { json_decoder decoder(alloc_); basic_json_parser parser; - parser.update(buffer.data(),buffer.size()); + parser.set_buffer(buffer.data(),buffer.size()); parser.parse_some(decoder, ec); if (ec) { @@ -400,7 +400,7 @@ namespace detail { { json_decoder decoder(alloc_); basic_json_parser parser; - parser.update(buffer.data(),buffer.size()); + parser.set_buffer(buffer.data(),buffer.size()); parser.parse_some(decoder, ec); if (ec) { @@ -428,7 +428,7 @@ namespace detail { { json_decoder decoder(alloc_); basic_json_parser parser; - parser.update(p_,end_input_ - p_); + parser.set_buffer(p_,end_input_ - p_); parser.parse_some(decoder, ec); if (ec) { diff --git a/test/corelib/src/json_parser_tests.cpp b/test/corelib/src/json_parser_tests.cpp index 4d78b2118..15890098d 100644 --- a/test/corelib/src/json_parser_tests.cpp +++ b/test/corelib/src/json_parser_tests.cpp @@ -87,7 +87,7 @@ TEST_CASE("test_parse_empty_object") static std::string s("{}"); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -104,7 +104,7 @@ TEST_CASE("test_parse_array") static std::string s("[]"); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -121,7 +121,7 @@ TEST_CASE("test_parse_string") static std::string s("\"\""); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -138,7 +138,7 @@ TEST_CASE("test_parse_integer") static std::string s("10"); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -155,7 +155,7 @@ TEST_CASE("test_parse_integer_space") static std::string s("10 "); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -172,7 +172,7 @@ TEST_CASE("test_parse_double_space") static std::string s("10.0 "); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -189,7 +189,7 @@ TEST_CASE("test_parse_false") static std::string s("false"); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -206,7 +206,7 @@ TEST_CASE("test_parse_true") static std::string s("true"); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -223,7 +223,7 @@ TEST_CASE("test_parse_null") static std::string s("null"); - parser.update(s.data(),s.length()); + parser.set_buffer(s.data(),s.length()); parser.parse_some(decoder); parser.finish_parse(decoder); CHECK(parser.done()); @@ -243,7 +243,7 @@ TEST_CASE("test_incremental_parsing") { if (index < chunks.size()) { - input.update(chunks[index].data(), chunks[index].size()); + input.set_buffer(chunks[index].data(), chunks[index].size()); ++index; return true; } @@ -282,7 +282,7 @@ TEST_CASE("test_parser_reinitialization") json_parser parser; parser.reset(); - parser.update("false true", 10); + parser.set_buffer("false true", 10); parser.finish_parse(decoder); CHECK(parser.done()); CHECK_FALSE(parser.source_exhausted()); @@ -291,7 +291,7 @@ TEST_CASE("test_parser_reinitialization") CHECK_FALSE(j1.as()); parser.reinitialize(); - parser.update("-42", 3); + parser.set_buffer("-42", 3); parser.finish_parse(decoder); CHECK(parser.done()); CHECK(parser.source_exhausted()); @@ -308,7 +308,7 @@ TEST_CASE("test_diagnostics_visitor", "") json_diagnostics_visitor visitor(os, " "); json_parser parser; std::string input(R"({"foo":[42,null]})"); - parser.update(input.data(), input.size()); + parser.set_buffer(input.data(), input.size()); parser.finish_parse(visitor); std::ostringstream expected; expected << "visit_begin_object" << std::endl @@ -327,7 +327,7 @@ TEST_CASE("test_diagnostics_visitor", "") wjson_diagnostics_visitor visitor(os, L" "); wjson_parser parser; std::wstring input(LR"({"foo":[42,null]})"); - parser.update(input.data(), input.size()); + parser.set_buffer(input.data(), input.size()); parser.finish_parse(visitor); std::wostringstream expected; expected << L"visit_begin_object" << std::endl diff --git a/test/csv/src/csv_cursor_tests.cpp b/test/csv/src/csv_cursor_tests.cpp index 0061de3f3..615b7369e 100644 --- a/test/csv/src/csv_cursor_tests.cpp +++ b/test/csv/src/csv_cursor_tests.cpp @@ -883,7 +883,7 @@ TEST_CASE("test_csv_parser_reinitialization") std::string input = "h1,h2\n" "3,4\n" "5,6\n"; - parser.update(input.data(), input.size()); + parser.set_buffer(input.data(), input.size()); int count = 0; while (!parser.stopped() && count < 20) { @@ -900,7 +900,7 @@ TEST_CASE("test_csv_parser_reinitialization") parser.reinitialize(); input = "h7,h8\n" "9,10\n"; - parser.update(input.data(), input.size()); + parser.set_buffer(input.data(), input.size()); count = 0; while (!parser.stopped() && count < 20) {