Set is_array in builder
This commit is contained in:
parent
11076bf337
commit
d6339aa015
|
@ -29,19 +29,6 @@ struct structural_parser : structural_iterator {
|
||||||
: structural_iterator(_dom_parser, start_structural_index) {
|
: 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>
|
template<typename T>
|
||||||
SIMDJSON_WARN_UNUSED simdjson_really_inline bool empty_object(T &builder) {
|
SIMDJSON_WARN_UNUSED simdjson_really_inline bool empty_object(T &builder) {
|
||||||
if (peek_next_char() == '}') {
|
if (peek_next_char() == '}') {
|
||||||
|
@ -110,7 +97,6 @@ SIMDJSON_WARN_UNUSED simdjson_really_inline error_code structural_parser::parse(
|
||||||
// Start the document
|
// Start the document
|
||||||
//
|
//
|
||||||
if (at_end()) { return EMPTY; }
|
if (at_end()) { return EMPTY; }
|
||||||
SIMDJSON_TRY( start_document() );
|
|
||||||
builder.start_document(*this);
|
builder.start_document(*this);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -151,7 +137,6 @@ object_begin: {
|
||||||
depth++;
|
depth++;
|
||||||
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
|
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
|
||||||
builder.start_object(*this);
|
builder.start_object(*this);
|
||||||
dom_parser.is_array[depth] = false;
|
|
||||||
|
|
||||||
const uint8_t *key = advance();
|
const uint8_t *key = advance();
|
||||||
if (*key != '"') {
|
if (*key != '"') {
|
||||||
|
@ -205,7 +190,6 @@ array_begin: {
|
||||||
depth++;
|
depth++;
|
||||||
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
|
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
|
||||||
builder.start_array(*this);
|
builder.start_array(*this);
|
||||||
dom_parser.is_array[depth] = true;
|
|
||||||
|
|
||||||
builder.increment_count(*this);
|
builder.increment_count(*this);
|
||||||
} // array_begin:
|
} // array_begin:
|
||||||
|
|
|
@ -58,14 +58,17 @@ private:
|
||||||
simdjson_really_inline void start_document(structural_parser &parser) {
|
simdjson_really_inline void start_document(structural_parser &parser) {
|
||||||
parser.log_start_value("document");
|
parser.log_start_value("document");
|
||||||
start_container(parser);
|
start_container(parser);
|
||||||
|
parser.dom_parser.is_array[parser.depth] = false;
|
||||||
}
|
}
|
||||||
simdjson_really_inline void start_object(structural_parser &parser) {
|
simdjson_really_inline void start_object(structural_parser &parser) {
|
||||||
parser.log_start_value("object");
|
parser.log_start_value("object");
|
||||||
start_container(parser);
|
start_container(parser);
|
||||||
|
parser.dom_parser.is_array[parser.depth] = false;
|
||||||
}
|
}
|
||||||
simdjson_really_inline void start_array(structural_parser &parser) {
|
simdjson_really_inline void start_array(structural_parser &parser) {
|
||||||
parser.log_start_value("array");
|
parser.log_start_value("array");
|
||||||
start_container(parser);
|
start_container(parser);
|
||||||
|
parser.dom_parser.is_array[parser.depth] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
simdjson_really_inline void end_object(structural_parser &parser) {
|
simdjson_really_inline void end_object(structural_parser &parser) {
|
||||||
|
|
Loading…
Reference in New Issue