Move on_start_* depth management to stage 2 code
This commit is contained in:
parent
2c8fd109de
commit
edaa8f811f
|
@ -1026,9 +1026,9 @@ public:
|
|||
inline void init_stage2() noexcept;
|
||||
really_inline error_code on_error(error_code new_error_code) noexcept; ///< @private
|
||||
really_inline error_code on_success(error_code success_code) noexcept; ///< @private
|
||||
really_inline bool on_start_document(uint32_t depth) noexcept; ///< @private
|
||||
really_inline bool on_start_object(uint32_t depth) noexcept; ///< @private
|
||||
really_inline bool on_start_array(uint32_t depth) noexcept; ///< @private
|
||||
really_inline bool on_start_document() noexcept; ///< @private
|
||||
really_inline bool on_start_object() noexcept; ///< @private
|
||||
really_inline bool on_start_array() noexcept; ///< @private
|
||||
// TODO we're not checking this bool
|
||||
really_inline bool on_end_document(uint32_t depth) noexcept; ///< @private
|
||||
really_inline bool on_end_object(uint32_t depth) noexcept; ///< @private
|
||||
|
|
|
@ -27,21 +27,15 @@ really_inline error_code parser::on_success(error_code success_code) noexcept {
|
|||
return success_code;
|
||||
}
|
||||
|
||||
really_inline bool parser::on_start_document(uint32_t depth) noexcept {
|
||||
containing_scope[depth].tape_index = current_loc;
|
||||
containing_scope[depth].count = 0;
|
||||
really_inline bool parser::on_start_document() noexcept {
|
||||
write_tape(0, internal::tape_type::ROOT); // if the document is correct, this gets rewritten later
|
||||
return true;
|
||||
}
|
||||
really_inline bool parser::on_start_object(uint32_t depth) noexcept {
|
||||
containing_scope[depth].tape_index = current_loc;
|
||||
containing_scope[depth].count = 0;
|
||||
really_inline bool parser::on_start_object() noexcept {
|
||||
write_tape(0, internal::tape_type::START_OBJECT); // if the document is correct, this gets rewritten later
|
||||
return true;
|
||||
}
|
||||
really_inline bool parser::on_start_array(uint32_t depth) noexcept {
|
||||
containing_scope[depth].tape_index = current_loc;
|
||||
containing_scope[depth].count = 0;
|
||||
really_inline bool parser::on_start_array() noexcept {
|
||||
write_tape(0, internal::tape_type::START_ARRAY); // if the document is correct, this gets rewritten later
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -126,21 +126,27 @@ struct structural_parser {
|
|||
) : structurals(buf, len, _doc_parser.structural_indexes.get(), next_structural), doc_parser{_doc_parser}, depth{0} {}
|
||||
|
||||
WARN_UNUSED really_inline bool start_document(ret_address continue_state) {
|
||||
doc_parser.on_start_document(depth);
|
||||
doc_parser.containing_scope[depth].tape_index = doc_parser.current_loc;
|
||||
doc_parser.containing_scope[depth].count = 0;
|
||||
doc_parser.on_start_document();
|
||||
doc_parser.ret_address[depth] = continue_state;
|
||||
depth++;
|
||||
return depth >= doc_parser.max_depth();
|
||||
}
|
||||
|
||||
WARN_UNUSED really_inline bool start_object(ret_address continue_state) {
|
||||
doc_parser.on_start_object(depth);
|
||||
doc_parser.containing_scope[depth].tape_index = doc_parser.current_loc;
|
||||
doc_parser.containing_scope[depth].count = 0;
|
||||
doc_parser.on_start_object();
|
||||
doc_parser.ret_address[depth] = continue_state;
|
||||
depth++;
|
||||
return depth >= doc_parser.max_depth();
|
||||
}
|
||||
|
||||
WARN_UNUSED really_inline bool start_array(ret_address continue_state) {
|
||||
doc_parser.on_start_array(depth);
|
||||
doc_parser.containing_scope[depth].tape_index = doc_parser.current_loc;
|
||||
doc_parser.containing_scope[depth].count = 0;
|
||||
doc_parser.on_start_array();
|
||||
doc_parser.ret_address[depth] = continue_state;
|
||||
depth++;
|
||||
return depth >= doc_parser.max_depth();
|
||||
|
|
Loading…
Reference in New Issue