Move on_end_* to stage 2 code

This commit is contained in:
John Keiser 2020-05-11 05:34:49 -07:00
parent 3d5ed1a7e3
commit 4f25b6ac0c
3 changed files with 7 additions and 23 deletions

View File

@ -1027,9 +1027,6 @@ public:
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
// TODO we're not checking this bool
really_inline bool on_end_document(uint32_t start_tape_index) noexcept; ///< @private
really_inline bool on_end_object(uint32_t start_tape_index) noexcept; ///< @private
really_inline bool on_end_array(uint32_t start_tape_index) noexcept; ///< @private
really_inline bool on_true_atom() noexcept; ///< @private
really_inline bool on_false_atom() noexcept; ///< @private
really_inline bool on_null_atom() noexcept; ///< @private

View File

@ -27,23 +27,6 @@ really_inline error_code parser::on_success(error_code success_code) noexcept {
return success_code;
}
// TODO we're not checking this bool
really_inline bool parser::on_end_document(uint32_t start_tape_index) noexcept {
// write our doc.tape location to the header scope
// The root scope gets written *at* the previous location.
write_tape(start_tape_index, internal::tape_type::ROOT);
return true;
}
really_inline bool parser::on_end_object(uint32_t start_tape_index) noexcept {
// write our doc.tape location to the header scope
write_tape(start_tape_index, internal::tape_type::END_OBJECT);
return true;
}
really_inline bool parser::on_end_array(uint32_t start_tape_index) noexcept {
// write our doc.tape location to the header scope
write_tape(start_tape_index, internal::tape_type::END_ARRAY);
return true;
}
really_inline bool parser::on_true_atom() noexcept {
write_tape(0, internal::tape_type::TRUE_VALUE);

View File

@ -165,19 +165,23 @@ struct structural_parser {
really_inline bool end_object() {
depth--;
doc_parser.on_end_object(doc_parser.containing_scope[depth].tape_index);
// write our doc.tape location to the header scope
doc_parser.write_tape(doc_parser.containing_scope[depth].tape_index, internal::tape_type::END_OBJECT);
end_scope();
return false;
}
really_inline bool end_array() {
depth--;
doc_parser.on_end_array(doc_parser.containing_scope[depth].tape_index);
// write our doc.tape location to the header scope
doc_parser.write_tape(doc_parser.containing_scope[depth].tape_index, internal::tape_type::END_ARRAY);
end_scope();
return false;
}
really_inline bool end_document() {
depth--;
doc_parser.on_end_document(doc_parser.containing_scope[depth].tape_index);
// write our doc.tape location to the header scope
// The root scope gets written *at* the previous location.
doc_parser.write_tape(doc_parser.containing_scope[depth].tape_index, internal::tape_type::ROOT);
end_scope();
return false;
}