@@ -158,7 +158,7 @@ UNUSED static char * format_masked_text(uint64_t mask, simd8x64<uint8_t> in) {
158
158
if (buf[i] <= ' ' ) { buf[i] = ' _' ; }
159
159
} else {
160
160
buf[i] = ' ' ;
161
- }
161
+ }
162
162
}
163
163
buf[64 ] = ' \0 ' ;
164
164
return buf;
@@ -234,7 +234,8 @@ really_inline uint64_t follows_odd_sequence_of(const uint64_t match, uint64_t &o
234
234
//
235
235
really_inline uint64_t find_series (const uint64_t match, const uint64_t separator, uint64_t &overflow) {
236
236
uint64_t result;
237
- overflow = sub_overflow (separator, match + overflow, &result);
237
+ overflow = sub_overflow (separator, overflow, &result);
238
+ overflow |= sub_overflow (result, match, &result);
238
239
return result;
239
240
}
240
241
@@ -268,8 +269,8 @@ really_inline ErrorValues json_structural_scanner::detect_errors_on_eof(bool str
268
269
if ((prev_in_string) and (not streaming)) {
269
270
return UNCLOSED_STRING;
270
271
}
271
- if (prev_separator ) {
272
- return TAPE_ERROR; // comma at the end is invalid
272
+ if (!prev_in_value ) {
273
+ return TAPE_ERROR; // open or comma at the end is invalid; there must be at least one value, too.
273
274
}
274
275
if (has_error) {
275
276
return UNESCAPED_CHARS; // TODO also out of order JSON
@@ -289,7 +290,7 @@ really_inline ErrorValues json_structural_scanner::detect_errors_on_eof(bool str
289
290
//
290
291
really_inline uint64_t json_structural_scanner::find_strings (const simd::simd8x64<uint8_t > in, uint64_t quote) {
291
292
const uint64_t backslash = in.eq (' \\ ' );
292
- const uint64_t escaped = follows_odd_sequence_of (backslash, prev_escaped) << 1 ;
293
+ const uint64_t escaped = follows_odd_sequence_of (backslash, prev_escaped);
293
294
const uint64_t real_quote = quote & ~escaped;
294
295
// prefix_xor flips on bits inside the string (and flips off the end quote).
295
296
const uint64_t in_string = prefix_xor (real_quote) ^ prev_in_string;
@@ -371,6 +372,7 @@ really_inline uint64_t json_structural_scanner::find_potential_structurals(const
371
372
372
373
// Separator/Open = 1: `1 {`, `} {`, `, ,`, `{ ,`
373
374
must_be_string = (separator|open ) & start_value;
375
+
374
376
// Quote = 0: `1"` `1"1` `"""`
375
377
must_be_string |= quote & ~start_value;
376
378
0 commit comments