Skip to content

Commit

Permalink
Revert 1.0.0 parsing change
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Jan 8, 2025
1 parent b773aa4 commit f5db1e6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/jsoncons/basic_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,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.set_buffer(source.data()+offset,source.size()-offset);
parser.update(source.data()+offset,source.size()-offset);
parser.parse_some(decoder);
parser.finish_parse(decoder);
parser.check_done();
Expand Down Expand Up @@ -2084,7 +2084,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.set_buffer(source.data()+offset,source.size()-offset);
parser.update(source.data()+offset,source.size()-offset);
parser.parse_some(decoder);
parser.finish_parse(decoder);
parser.check_done();
Expand Down
6 changes: 3 additions & 3 deletions include/jsoncons/json_cursor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class basic_json_cursor : public basic_staj_cursor<CharT>, private virtual ser_c
if (ec) {return;}
if (s.size() > 0)
{
parser_.set_buffer(s.data(),s.size());
parser_.update(s.data(),s.size());
}
}
if (!parser_.source_exhausted())
Expand Down Expand Up @@ -398,7 +398,7 @@ class basic_json_cursor : public basic_staj_cursor<CharT>, private virtual ser_c
return;
}
std::size_t offset = (r.ptr - sv.data());
parser_.set_buffer(sv.data()+offset,sv.size()-offset);
parser_.update(sv.data()+offset,sv.size()-offset);
bool is_done = parser_.done() || done_;
if (!is_done)
{
Expand Down Expand Up @@ -444,7 +444,7 @@ class basic_json_cursor : public basic_staj_cursor<CharT>, private virtual ser_c
if (ec) {return;}
if (s.size() > 0)
{
parser_.set_buffer(s.data(),s.size());
parser_.update(s.data(),s.size());
if (ec) {return;}
}
}
Expand Down
3 changes: 3 additions & 0 deletions include/jsoncons/json_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ class basic_json_parser : public ser_context
more_ = false;
break;
case json_parse_state::start:
more_ = false;
ec = json_errc::unexpected_eof;
break;
case json_parse_state::done:
more_ = false;
break;
Expand Down
2 changes: 2 additions & 0 deletions include/jsoncons/json_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ namespace jsoncons {
}
}

parser_.skip_whitespace();
while (!source_.eof())
{
parser_.skip_whitespace();
Expand Down Expand Up @@ -389,6 +390,7 @@ namespace jsoncons {

bool eof() const
{
std::cout << "parser no more source: " << parser_.source_exhausted() << ", source eof: " << source_.eof() << "\n";
return parser_.source_exhausted() && source_.eof();
}

Expand Down

0 comments on commit f5db1e6

Please sign in to comment.