From d6339aa0155c7a3aacecd250269c10427e42048c Mon Sep 17 00:00:00 2001 From: John Keiser Date: Tue, 4 Aug 2020 15:47:34 -0700 Subject: [PATCH] Set is_array in builder --- src/generic/stage2/structural_parser.h | 16 ---------------- src/generic/stage2/tape_builder.h | 3 +++ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/generic/stage2/structural_parser.h b/src/generic/stage2/structural_parser.h index 75f09853..101b2f1b 100644 --- a/src/generic/stage2/structural_parser.h +++ b/src/generic/stage2/structural_parser.h @@ -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 - 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 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: diff --git a/src/generic/stage2/tape_builder.h b/src/generic/stage2/tape_builder.h index d57bc21d..4e0ecefe 100644 --- a/src/generic/stage2/tape_builder.h +++ b/src/generic/stage2/tape_builder.h @@ -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) {