Set is_array in builder

This commit is contained in:
John Keiser 2020-08-04 15:47:34 -07:00
parent 11076bf337
commit d6339aa015
2 changed files with 3 additions and 16 deletions

View File

@ -29,19 +29,6 @@ struct structural_parser : structural_iterator {
: structural_iterator(_dom_parser, start_structural_index) {
}
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code start_document() {
dom_parser.is_array[depth] = false;
return SUCCESS;
}
template<typename T>
SIMDJSON_WARN_UNUSED simdjson_really_inline error_code start_array(T &builder) {
depth++;
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
builder.start_array(*this);
dom_parser.is_array[depth] = true;
return SUCCESS;
}
template<typename T>
SIMDJSON_WARN_UNUSED simdjson_really_inline bool empty_object(T &builder) {
if (peek_next_char() == '}') {
@ -110,7 +97,6 @@ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code structural_parser::parse(
// Start the document
//
if (at_end()) { return EMPTY; }
SIMDJSON_TRY( start_document() );
builder.start_document(*this);
//
@ -151,7 +137,6 @@ object_begin: {
depth++;
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
builder.start_object(*this);
dom_parser.is_array[depth] = false;
const uint8_t *key = advance();
if (*key != '"') {
@ -205,7 +190,6 @@ array_begin: {
depth++;
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
builder.start_array(*this);
dom_parser.is_array[depth] = true;
builder.increment_count(*this);
} // array_begin:

View File

@ -58,14 +58,17 @@ private:
simdjson_really_inline void start_document(structural_parser &parser) {
parser.log_start_value("document");
start_container(parser);
parser.dom_parser.is_array[parser.depth] = false;
}
simdjson_really_inline void start_object(structural_parser &parser) {
parser.log_start_value("object");
start_container(parser);
parser.dom_parser.is_array[parser.depth] = false;
}
simdjson_really_inline void start_array(structural_parser &parser) {
parser.log_start_value("array");
start_container(parser);
parser.dom_parser.is_array[parser.depth] = true;
}
simdjson_really_inline void end_object(structural_parser &parser) {