Move on_start_* to stage 2 code

This commit is contained in:
John Keiser 2020-05-11 05:30:35 -07:00
parent a03115a4a6
commit 3d5ed1a7e3
3 changed files with 5 additions and 20 deletions

View File

@ -1026,9 +1026,6 @@ 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() 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 start_tape_index) noexcept; ///< @private
really_inline bool on_end_object(uint32_t start_tape_index) noexcept; ///< @private
@ -1041,6 +1038,8 @@ public:
really_inline bool on_number_s64(int64_t value) noexcept; ///< @private
really_inline bool on_number_u64(uint64_t value) noexcept; ///< @private
really_inline bool on_number_double(double value) noexcept; ///< @private
inline void write_tape(uint64_t val, internal::tape_type t) noexcept;
private:
/**
* The maximum document length this parser will automatically support.
@ -1085,8 +1084,6 @@ private:
//
//
inline void write_tape(uint64_t val, internal::tape_type t) noexcept;
/**
* Ensure we have enough capacity to handle at least desired_capacity bytes,
* and auto-allocate if not.

View File

@ -27,18 +27,6 @@ really_inline error_code parser::on_success(error_code success_code) noexcept {
return success_code;
}
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() 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() noexcept {
write_tape(0, internal::tape_type::START_ARRAY); // if the document is correct, this gets rewritten later
return true;
}
// 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

View File

@ -128,7 +128,7 @@ struct structural_parser {
WARN_UNUSED really_inline bool start_document(ret_address continue_state) {
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.write_tape(0, internal::tape_type::ROOT); // if the document is correct, this gets rewritten later
doc_parser.ret_address[depth] = continue_state;
depth++;
return depth >= doc_parser.max_depth();
@ -137,7 +137,7 @@ struct structural_parser {
WARN_UNUSED really_inline bool start_object(ret_address continue_state) {
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.write_tape(0, internal::tape_type::START_OBJECT); // if the document is correct, this gets rewritten later
doc_parser.ret_address[depth] = continue_state;
depth++;
return depth >= doc_parser.max_depth();
@ -146,7 +146,7 @@ struct structural_parser {
WARN_UNUSED really_inline bool start_array(ret_address continue_state) {
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.write_tape(0, internal::tape_type::START_ARRAY); // if the document is correct, this gets rewritten later
doc_parser.ret_address[depth] = continue_state;
depth++;
return depth >= doc_parser.max_depth();