@@ -98,6 +98,7 @@ really_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2, c
9898 return is_third_byte ^ is_fourth_byte;
9999}
100100
101+ } // namespace {
101102} // namespace SIMDJSON_IMPLEMENTATION
102103} // namespace simdjson
103104
@@ -120,6 +121,7 @@ namespace simdjson {
120121namespace SIMDJSON_IMPLEMENTATION {
121122
122123namespace stage1 {
124+ namespace {
123125
124126really_inline uint64_t json_string_scanner::find_escaped (uint64_t backslash) {
125127 // On ARM, we don't short-circuit this if there are no backslashes, because the branch gives us no
@@ -128,6 +130,7 @@ really_inline uint64_t json_string_scanner::find_escaped(uint64_t backslash) {
128130 return find_escaped_branchless (backslash);
129131}
130132
133+ } // namespace {
131134} // namespace stage1
132135
133136WARN_UNUSED error_code implementation::minify (const uint8_t *buf, size_t len, uint8_t *dst, size_t &dst_len) const noexcept {
@@ -144,6 +147,23 @@ WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) cons
144147 return simdjson::arm64::stage1::generic_validate_utf8 (buf,len);
145148}
146149
150+ WARN_UNUSED error_code dom_parser_implementation::stage2 (dom::document &_doc) noexcept {
151+ error_code result = stage2::parse_structurals<false >(*this , _doc);
152+ if (result) { return result; }
153+
154+ // If we didn't make it to the end, it's an error
155+ if ( next_structural_index != n_structural_indexes ) {
156+ logger::log_string (" More than one JSON value at the root of the document, or extra characters at the end of the JSON!" );
157+ return error = TAPE_ERROR;
158+ }
159+
160+ return SUCCESS;
161+ }
162+
163+ WARN_UNUSED error_code dom_parser_implementation::stage2_next (dom::document &_doc) noexcept {
164+ return stage2::parse_structurals<true >(*this , _doc);
165+ }
166+
147167WARN_UNUSED error_code dom_parser_implementation::parse (const uint8_t *_buf, size_t _len, dom::document &_doc) noexcept {
148168 error_code err = stage1 (_buf, _len, false );
149169 if (err) { return err; }
0 commit comments