@@ -34,18 +34,18 @@ namespace internal {
3434 * */
3535inline uint32_t find_last_json_buf_idx (const uint8_t *buf, size_t size, const dom::parser &parser) {
3636 // this function can be generally useful
37- if (parser.n_structural_indexes == 0 )
37+ if (parser.implementation -> n_structural_indexes == 0 )
3838 return 0 ;
39- auto last_i = parser.n_structural_indexes - 1 ;
40- if (parser.structural_indexes [last_i] == size) {
39+ auto last_i = parser.implementation -> n_structural_indexes - 1 ;
40+ if (parser.implementation -> structural_indexes [last_i] == size) {
4141 if (last_i == 0 )
4242 return 0 ;
43- last_i = parser.n_structural_indexes - 2 ;
43+ last_i = parser.implementation -> n_structural_indexes - 2 ;
4444 }
4545 auto arr_cnt = 0 ;
4646 auto obj_cnt = 0 ;
4747 for (auto i = last_i; i > 0 ; i--) {
48- auto idxb = parser.structural_indexes [i];
48+ auto idxb = parser.implementation -> structural_indexes [i];
4949 switch (buf[idxb]) {
5050 case ' :' :
5151 case ' ,' :
@@ -63,7 +63,7 @@ inline uint32_t find_last_json_buf_idx(const uint8_t *buf, size_t size, const do
6363 arr_cnt++;
6464 break ;
6565 }
66- auto idxa = parser.structural_indexes [i - 1 ];
66+ auto idxa = parser.implementation -> structural_indexes [i - 1 ];
6767 switch (buf[idxa]) {
6868 case ' {' :
6969 case ' [' :
@@ -172,17 +172,17 @@ inline error_code document_stream::json_parse() noexcept {
172172 if (_batch_size == 0 ) {
173173 return simdjson::UTF8_ERROR;
174174 }
175- auto stage1_is_ok = error_code (parser.implementation ->stage1 (buf (), _batch_size, parser, true ));
175+ auto stage1_is_ok = error_code (parser.implementation ->stage1 (buf (), _batch_size, true ));
176176 if (stage1_is_ok != simdjson::SUCCESS) {
177177 return stage1_is_ok;
178178 }
179179 uint32_t last_index = internal::find_last_json_buf_idx (buf (), _batch_size, parser);
180180 if (last_index == 0 ) {
181- if (parser.n_structural_indexes == 0 ) {
181+ if (parser.implementation -> n_structural_indexes == 0 ) {
182182 return simdjson::EMPTY;
183183 }
184184 } else {
185- parser.n_structural_indexes = last_index + 1 ;
185+ parser.implementation -> n_structural_indexes = last_index + 1 ;
186186 }
187187 }
188188 // the second thread is running or done.
@@ -191,15 +191,15 @@ inline error_code document_stream::json_parse() noexcept {
191191 if (stage1_is_ok_thread != simdjson::SUCCESS) {
192192 return stage1_is_ok_thread;
193193 }
194- std::swap (parser.structural_indexes , parser_thread.structural_indexes );
195- parser.n_structural_indexes = parser_thread.n_structural_indexes ;
194+ std::swap (parser.implementation -> structural_indexes , parser_thread.implementation -> structural_indexes );
195+ parser.implementation -> n_structural_indexes = parser_thread.implementation -> n_structural_indexes ;
196196 advance (last_json_buffer_loc);
197197 n_bytes_parsed += last_json_buffer_loc;
198198 }
199199 // let us decide whether we will start a new thread
200200 if (remaining () - _batch_size > 0 ) {
201201 last_json_buffer_loc =
202- parser.structural_indexes [internal::find_last_json_buf_idx (buf (), _batch_size, parser)];
202+ parser.implementation -> structural_indexes [internal::find_last_json_buf_idx (buf (), _batch_size, parser)];
203203 _batch_size = (std::min)(_batch_size, remaining () - last_json_buffer_loc);
204204 if (_batch_size > 0 ) {
205205 _batch_size = internal::trimmed_length_safe_utf8 (
@@ -214,22 +214,22 @@ inline error_code document_stream::json_parse() noexcept {
214214 // this->stage1_is_ok_thread
215215 // there is only one thread that may write to this value
216216 stage_1_thread = std::thread ([this , b, bs] {
217- this ->stage1_is_ok_thread = error_code (parser_thread.implementation ->stage1 (b, bs, this -> parser_thread , true ));
217+ this ->stage1_is_ok_thread = error_code (parser_thread.implementation ->stage1 (b, bs, true ));
218218 });
219219 }
220220 }
221221 next_json = 0 ;
222222 load_next_batch = false ;
223223 } // load_next_batch
224- error_code res = parser.implementation ->stage2 (buf (), remaining (), parser, next_json);
224+ error_code res = parser.implementation ->stage2 (buf (), remaining (), parser. doc , next_json);
225225 if (res == simdjson::SUCCESS_AND_HAS_MORE) {
226226 n_parsed_docs++;
227- current_buffer_loc = parser.structural_indexes [next_json];
227+ current_buffer_loc = parser.implementation -> structural_indexes [next_json];
228228 load_next_batch = (current_buffer_loc == last_json_buffer_loc);
229229 } else if (res == simdjson::SUCCESS) {
230230 n_parsed_docs++;
231231 if (remaining () > _batch_size) {
232- current_buffer_loc = parser.structural_indexes [next_json - 1 ];
232+ current_buffer_loc = parser.implementation -> structural_indexes [next_json - 1 ];
233233 load_next_batch = true ;
234234 res = simdjson::SUCCESS_AND_HAS_MORE;
235235 }
@@ -249,28 +249,28 @@ inline error_code document_stream::json_parse() noexcept {
249249 n_bytes_parsed += current_buffer_loc;
250250 _batch_size = (std::min)(_batch_size, remaining ());
251251 _batch_size = internal::trimmed_length_safe_utf8 ((const char *)buf (), _batch_size);
252- auto stage1_is_ok = (error_code)parser.implementation ->stage1 (buf (), _batch_size, parser, true );
252+ auto stage1_is_ok = (error_code)parser.implementation ->stage1 (buf (), _batch_size, true );
253253 if (stage1_is_ok != simdjson::SUCCESS) {
254254 return stage1_is_ok;
255255 }
256256 uint32_t last_index = internal::find_last_json_buf_idx (buf (), _batch_size, parser);
257257 if (last_index == 0 ) {
258- if (parser.n_structural_indexes == 0 ) {
258+ if (parser.implementation -> n_structural_indexes == 0 ) {
259259 return EMPTY;
260260 }
261261 } else {
262- parser.n_structural_indexes = last_index + 1 ;
262+ parser.implementation -> n_structural_indexes = last_index + 1 ;
263263 }
264264 load_next_batch = false ;
265265 } // load_next_batch
266- error_code res = parser.implementation ->stage2 (buf (), remaining (), parser, next_json);
266+ error_code res = parser.implementation ->stage2 (buf (), remaining (), parser. doc , next_json);
267267 if (likely (res == simdjson::SUCCESS_AND_HAS_MORE)) {
268268 n_parsed_docs++;
269- current_buffer_loc = parser.structural_indexes [next_json];
269+ current_buffer_loc = parser.implementation -> structural_indexes [next_json];
270270 } else if (res == simdjson::SUCCESS) {
271271 n_parsed_docs++;
272272 if (remaining () > _batch_size) {
273- current_buffer_loc = parser.structural_indexes [next_json - 1 ];
273+ current_buffer_loc = parser.implementation -> structural_indexes [next_json - 1 ];
274274 next_json = 1 ;
275275 load_next_batch = true ;
276276 res = simdjson::SUCCESS_AND_HAS_MORE;
0 commit comments