@@ -102,6 +102,16 @@ struct tape_builder {
102
102
tape.append (start_tape_index, internal::tape_type::ROOT);
103
103
tape_writer::write (iter.dom_parser .doc ->tape [start_tape_index], next_tape_index (iter), internal::tape_type::ROOT);
104
104
}
105
+ // Called after end_object/end_array. Not called after empty_object/empty_array,
106
+ // as the parent is already known in those cases.
107
+ //
108
+ // The object returned from end_container() should support the in_container(),
109
+ // in_array() and in_object() methods, allowing the iterator to branch to the
110
+ // correct place.
111
+ really_inline tape_builder &end_container (structural_parser &iter) {
112
+ iter.depth --;
113
+ return *this ;
114
+ }
105
115
106
116
WARN_UNUSED really_inline error_code parse_key (structural_parser &iter, const uint8_t *value) {
107
117
return parse_string (iter, value, true );
@@ -195,6 +205,15 @@ struct tape_builder {
195
205
really_inline void increment_count (structural_parser &iter) {
196
206
iter.dom_parser .open_containers [iter.depth ].count ++; // we have a key value pair in the object at parser.dom_parser.depth - 1
197
207
}
208
+ really_inline bool in_container (structural_parser &iter) {
209
+ return iter.depth != 0 ;
210
+ }
211
+ really_inline bool in_array (structural_parser &iter) {
212
+ return iter.dom_parser .is_array [iter.depth ];
213
+ }
214
+ really_inline bool in_object (structural_parser &iter) {
215
+ return !iter.dom_parser .is_array [iter.depth ];
216
+ }
198
217
199
218
// private:
200
219
0 commit comments