yeptris 0.6.65.0-riscv64-linux-gnu → 0.6.66.0-riscv64-linux-gnu

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,11 @@
5
5
  * the kernel at the next sequence boundary. The original SWAR path
6
6
  * broke at the first non-ASCII byte and never recovered.
7
7
  *
8
+ * The well-formedness face (yep_utf8_validate) rides a byte-DFA first
9
+ * (issue #742): one table load per byte answers the dirty-span case,
10
+ * with the gate kernel still taking the all-ASCII span in one call.
11
+ * The exact walk remains the authority on rejections (err_pos).
12
+ *
8
13
  * Rules enforced (Unicode 15 well-formedness): no overlong encodings, no
9
14
  * UTF-16 surrogate code points (U+D800..U+DFFF), nothing above U+10FFFF,
10
15
  * continuation bytes only where a sequence expects them.
@@ -169,7 +174,364 @@ static int validate(const unsigned char* p, size_t len, size_t* err_pos, int pri
169
174
  return 1;
170
175
  }
171
176
 
177
+ /* ---- the well-formedness DFA fast path (issue #742) -------------------
178
+ *
179
+ * The CBOR decode profile puts ~40% of the scan-only lane in the
180
+ * per-byte step walk: real corpora are ~3% high bytes but scattered,
181
+ * so two thirds of the 32-byte gate windows go dirty and the exact
182
+ * walk rules them byte by byte (nine-branch first-byte cascade plus
183
+ * per-byte ascii_ok). The DFA answers each byte with ONE table load:
184
+ * class (the byte's role) then next-state, with the overlong/
185
+ * surrogate/U+10FFFF bounds encoded in the transitions — the same
186
+ * rules step() enforces, in the same order along the span.
187
+ *
188
+ * Verdict equivalence is pinned three ways: the tables were derived
189
+ * from step()'s range rules; a differential harness walked every
190
+ * boundary sequence of length <= 4 (29 range-edge bytes), the full
191
+ * two-byte alphabet, every (lead, continuation) pair for the
192
+ * multi-byte leads, the truncation shapes, 1M random strings, and the
193
+ * fuzz corpus — 0 mismatches; and test_encoding's pinned verdicts +
194
+ * err_pos ride the suite. On any DFA rejection the authoritative walk
195
+ * below re-runs for the pinned err_pos (invalid inputs take the exact
196
+ * path; valid ones never do).
197
+ *
198
+ * The gate answers only the long spans (>= 128 B): short ones (CBOR
199
+ * map keys are single-digit bytes) fall through the kernel's 16-byte
200
+ * loop into its scalar per-byte walk, paying a dispatch lookup to get
201
+ * there — the SWAR loop below answers those spans directly. */
202
+
203
+ static const uint8_t utf8_class[256] = {
204
+ /* 00-7F ASCII */ 0,
205
+ 0,
206
+ 0,
207
+ 0,
208
+ 0,
209
+ 0,
210
+ 0,
211
+ 0,
212
+ 0,
213
+ 0,
214
+ 0,
215
+ 0,
216
+ 0,
217
+ 0,
218
+ 0,
219
+ 0,
220
+ 0,
221
+ 0,
222
+ 0,
223
+ 0,
224
+ 0,
225
+ 0,
226
+ 0,
227
+ 0,
228
+ 0,
229
+ 0,
230
+ 0,
231
+ 0,
232
+ 0,
233
+ 0,
234
+ 0,
235
+ 0,
236
+ 0,
237
+ 0,
238
+ 0,
239
+ 0,
240
+ 0,
241
+ 0,
242
+ 0,
243
+ 0,
244
+ 0,
245
+ 0,
246
+ 0,
247
+ 0,
248
+ 0,
249
+ 0,
250
+ 0,
251
+ 0,
252
+ 0,
253
+ 0,
254
+ 0,
255
+ 0,
256
+ 0,
257
+ 0,
258
+ 0,
259
+ 0,
260
+ 0,
261
+ 0,
262
+ 0,
263
+ 0,
264
+ 0,
265
+ 0,
266
+ 0,
267
+ 0,
268
+ 0,
269
+ 0,
270
+ 0,
271
+ 0,
272
+ 0,
273
+ 0,
274
+ 0,
275
+ 0,
276
+ 0,
277
+ 0,
278
+ 0,
279
+ 0,
280
+ 0,
281
+ 0,
282
+ 0,
283
+ 0,
284
+ 0,
285
+ 0,
286
+ 0,
287
+ 0,
288
+ 0,
289
+ 0,
290
+ 0,
291
+ 0,
292
+ 0,
293
+ 0,
294
+ 0,
295
+ 0,
296
+ 0,
297
+ 0,
298
+ 0,
299
+ 0,
300
+ 0,
301
+ 0,
302
+ 0,
303
+ 0,
304
+ 0,
305
+ 0,
306
+ 0,
307
+ 0,
308
+ 0,
309
+ 0,
310
+ 0,
311
+ 0,
312
+ 0,
313
+ 0,
314
+ 0,
315
+ 0,
316
+ 0,
317
+ 0,
318
+ 0,
319
+ 0,
320
+ 0,
321
+ 0,
322
+ 0,
323
+ 0,
324
+ 0,
325
+ 0,
326
+ 0,
327
+ 0,
328
+ 0,
329
+ 0,
330
+ 0,
331
+ 0,
332
+ /* 80-8F */ 1,
333
+ 1,
334
+ 1,
335
+ 1,
336
+ 1,
337
+ 1,
338
+ 1,
339
+ 1,
340
+ 1,
341
+ 1,
342
+ 1,
343
+ 1,
344
+ 1,
345
+ 1,
346
+ 1,
347
+ 1,
348
+ /* 90-9F */ 2,
349
+ 2,
350
+ 2,
351
+ 2,
352
+ 2,
353
+ 2,
354
+ 2,
355
+ 2,
356
+ 2,
357
+ 2,
358
+ 2,
359
+ 2,
360
+ 2,
361
+ 2,
362
+ 2,
363
+ 2,
364
+ /* A0-BF */ 3,
365
+ 3,
366
+ 3,
367
+ 3,
368
+ 3,
369
+ 3,
370
+ 3,
371
+ 3,
372
+ 3,
373
+ 3,
374
+ 3,
375
+ 3,
376
+ 3,
377
+ 3,
378
+ 3,
379
+ 3,
380
+ 3,
381
+ 3,
382
+ 3,
383
+ 3,
384
+ 3,
385
+ 3,
386
+ 3,
387
+ 3,
388
+ 3,
389
+ 3,
390
+ 3,
391
+ 3,
392
+ 3,
393
+ 3,
394
+ 3,
395
+ 3,
396
+ /* C0-C1 overlong, C2-DF two-byte */ 4,
397
+ 4,
398
+ 5,
399
+ 5,
400
+ 5,
401
+ 5,
402
+ 5,
403
+ 5,
404
+ 5,
405
+ 5,
406
+ 5,
407
+ 5,
408
+ 5,
409
+ 5,
410
+ 5,
411
+ 5,
412
+ 5,
413
+ 5,
414
+ 5,
415
+ 5,
416
+ 5,
417
+ 5,
418
+ 5,
419
+ 5,
420
+ 5,
421
+ 5,
422
+ 5,
423
+ 5,
424
+ 5,
425
+ 5,
426
+ 5,
427
+ 5,
428
+ /* E0, E1-EC, ED, EE-EF */ 6,
429
+ 7,
430
+ 7,
431
+ 7,
432
+ 7,
433
+ 7,
434
+ 7,
435
+ 7,
436
+ 7,
437
+ 7,
438
+ 7,
439
+ 7,
440
+ 7,
441
+ 8,
442
+ 7,
443
+ 7,
444
+ /* F0, F1-F3, F4, F5-FF */ 9,
445
+ 10,
446
+ 10,
447
+ 10,
448
+ 11,
449
+ 12,
450
+ 12,
451
+ 12,
452
+ 12,
453
+ 12,
454
+ 12,
455
+ 12,
456
+ 12,
457
+ 12,
458
+ 12,
459
+ 12,
460
+ };
461
+
462
+ #define UTF8_ST_INVALID 255
463
+ /* 0 START; 1 expect one 80-BF; 2 expect two 80-BF; 3 E0->A0-BF;
464
+ * 4 F0->90-BF; 5 ED->80-9F; 6 expect three 80-BF; 7 F4->80-8F.
465
+ * Indexed [state * 16 + class]. */
466
+ static const uint8_t utf8_next[8 * 16] = {
467
+ 0, 255, 255, 255, 255, 1, 3, 2, 5, 4, 6, 7, 255, 255, 255, 255, 255, 0, 0,
468
+ 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 1, 1, 255, 255,
469
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 255, 255, 255, 255, 255,
470
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 2, 2, 255, 255, 255, 255, 255, 255, 255, 255,
471
+ 255, 255, 255, 255, 255, 1, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
472
+ 255, 255, 2, 2, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 2,
473
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
474
+ };
475
+
476
+ /* Verdict-identical to the printable=0 walk (the differential gates
477
+ * above; the suite pins the observable). 1 = well-formed.
478
+ *
479
+ * The loop rides the input's shape: in START state the span's ASCII
480
+ * runs (97% of real text) advance eight bytes per SWAR test with no
481
+ * DFA traffic — the high-byte islands pay the table loads alone. The
482
+ * per-byte branchy walk paid the nine-branch cascade per NON-ASCII
483
+ * byte and a call per ASCII byte inside dirty windows; the DFA pays
484
+ * two dependent table loads per non-ASCII byte and nothing else. */
485
+ static int validate_wellformed(const unsigned char* p, size_t len) {
486
+ /* the gate pays off on long spans only: short ones (CBOR map keys
487
+ * are single-digit bytes — the #742 profile) fall through the
488
+ * kernel's 16-byte loop into its scalar per-byte walk, paying a
489
+ * dispatch lookup to get there; the SWAR loop below answers those
490
+ * spans directly */
491
+ if (len >= 128 && yep_text_active()->gate_scan((const char*)p, len) == 0) {
492
+ return 1; /* every byte gate-safe ASCII */
493
+ }
494
+ uint8_t st = 0;
495
+ size_t j = 0;
496
+ for (;;) {
497
+ while (st == 0 && j + 8 <= len) { /* START-state ASCII runs, 8 bytes per test */
498
+ uint64_t w;
499
+ memcpy(&w, p + j, sizeof(w));
500
+ if ((w & 0x8080808080808080ull) != 0) {
501
+ break;
502
+ }
503
+ j += 8;
504
+ }
505
+ while (st == 0 && j < len && p[j] < 0x80) { /* the ASCII tail under 8 bytes */
506
+ j++;
507
+ }
508
+ if (j >= len) {
509
+ break;
510
+ }
511
+ st = utf8_next[(uint8_t)((st << 4) | utf8_class[p[j]])];
512
+ if (st == UTF8_ST_INVALID) {
513
+ return 0;
514
+ }
515
+ j++;
516
+ }
517
+ return st == 0;
518
+ }
519
+
172
520
  int yep_utf8_validate(const unsigned char* p, size_t len, size_t* err_pos) {
521
+ if (p == NULL && len != 0) {
522
+ if (err_pos != NULL) {
523
+ *err_pos = 0;
524
+ }
525
+ return 0;
526
+ }
527
+ if (validate_wellformed(p, len)) {
528
+ if (err_pos != NULL) {
529
+ *err_pos = 0;
530
+ }
531
+ return 1;
532
+ }
533
+ /* the DFA said no: the authoritative walk finds the byte (the
534
+ * err_pos contract is pinned by test_encoding) */
173
535
  return validate(p, len, err_pos, 0);
174
536
  }
175
537
 
@@ -72,10 +72,14 @@ struct yep_engine {
72
72
  yep_line_info li_cache; /* per-line scan_line memo: every site
73
73
  positioned at line_start reads it (plain continuation checks,
74
74
  literal blocks, the main loop), so a line is scanned once */
75
- uint32_t li_cache_line; /* 0 = no entry (line numbers are 1-based) */
75
+ uint32_t memo_line; /* the ONE line key (TODO.max-perf/02):
76
+ facts+li validity, 0 = empty (lines are
77
+ 1-based); sits in li_cache_line's old slot
78
+ so the struct geometry does not move */
76
79
  yep_line_shape shape_cache; /* per-line shape memo (TODO.restructure/49):
77
80
  the dispatch decision is made once */
78
- uint32_t shape_cache_line; /* 0 = no entry */
81
+ uint32_t shape_line; /* the shape's own lazy key: 0 = empty (the
82
+ * shape_cache_line slot) */
79
83
  uint32_t line_base; /* lines consumed by earlier stepped runs */
80
84
  yep_error err;
81
85
  const yep_sink* sink;
@@ -107,7 +111,10 @@ struct yep_engine {
107
111
  /* the line-facts memo (TODO.restructure/76): one kernel pass per
108
112
  * line feeds both the line info and the shape */
109
113
  yep_line_facts facts_cache;
110
- uint32_t facts_cache_line;
114
+ uint32_t facts_pad; /* keeps every field after the old facts_cache_line
115
+ * at its original offset: the fusion removes one
116
+ * uint32 key, the pad restores the geometry so the
117
+ * A/B isolates the logic from layout luck */
111
118
 
112
119
  yep_fold_line fold[YEP_MAX_FOLD_LINES];
113
120
  size_t fold_n;
@@ -351,45 +358,36 @@ static void e_line_done(yep_engine* e, size_t at) {
351
358
  e->pos = at + br;
352
359
  e->line++;
353
360
  e->line_start = e->pos;
354
- e->li_cache_line = 0;
355
- e->shape_cache_line = 0;
356
- e->facts_cache_line = 0;
361
+ e->memo_line = 0;
362
+ e->shape_line = 0;
357
363
  } else {
358
364
  e->pos = at;
359
365
  }
360
366
  }
361
367
 
362
- /* The line-facts memo (TODO.restructure/76): ONE kernel pass per
363
- * line; li and the shape both derive from it. */
364
- static const yep_line_facts* e_facts_here(yep_engine* e) {
365
- if (e->facts_cache_line != e->line) {
366
- yep_scan_facts(e->p, e->len, e->line_start, &e->facts_cache);
367
- e->facts_cache_line = e->line;
368
- e->li_cache_line = 0; /* derived caches are stale now */
369
- e->shape_cache_line = 0;
370
- }
371
- return &e->facts_cache;
372
- }
373
-
374
- /* scan_line for the current line, memoized for the flow loop (the
375
- * loop head and the post-ws check each need it every line). */
368
+ /* The one-memo (TODO.max-perf/02): the per-line lane behind ONE line
369
+ * key. A miss computes facts and li back-to-back (yep_scan_line_f
370
+ * reads the facts in place — yep_scan_line is exactly this pair), so
371
+ * every site's hit check is a single compare+branch where a facts
372
+ * check plus a li check stood; the shape derives lazily on its own
373
+ * key because only e_classified's dispatch needs it. */
376
374
  static yep_line_info e_line_info_here(yep_engine* e) {
377
- const yep_line_facts* f = e_facts_here(e);
378
- if (e->li_cache_line != e->line) {
379
- yep_scan_line_f(e->p, e->len, e->line_start, f, &e->li_cache);
380
- e->li_cache_line = e->line;
375
+ if (e->memo_line != e->line) {
376
+ yep_scan_facts(e->p, e->len, e->line_start, &e->facts_cache);
377
+ yep_scan_line_f(e->p, e->len, e->line_start, &e->facts_cache, &e->li_cache);
378
+ e->memo_line = e->line;
379
+ e->shape_line = 0; /* the shape reads li: stale now */
381
380
  }
382
381
  return e->li_cache;
383
382
  }
384
383
 
385
- /* The line's classified shape, memoized beside the line facts: the
384
+ /* The line's classified shape, memoized beside the one-memo: the
386
385
  * engine decides dispatch ONCE per line (TODO.restructure/49). */
387
386
  static const yep_line_shape* e_shape_here(yep_engine* e) {
388
- const yep_line_facts* f = e_facts_here(e);
389
- e_line_info_here(e);
390
- if (e->shape_cache_line != e->line) {
391
- yep_scan_shape_f(e->p, e->len, &e->li_cache, f, &e->shape_cache);
392
- e->shape_cache_line = e->line;
387
+ e_line_info_here(e); /* facts+li ride the same key */
388
+ if (e->shape_line != e->line) {
389
+ yep_scan_shape_f(e->p, e->len, &e->li_cache, &e->facts_cache, &e->shape_cache);
390
+ e->shape_line = e->line;
393
391
  }
394
392
  return &e->shape_cache;
395
393
  }
@@ -1017,8 +1015,8 @@ static int e_block_scalar(yep_engine* e, yep_event* ev, int parent_col) {
1017
1015
  e->pos = at + br;
1018
1016
  e->line++;
1019
1017
  e->line_start = e->pos;
1020
- e->li_cache_line = 0;
1021
- e->shape_cache_line = 0;
1018
+ e->memo_line = 0;
1019
+ e->shape_line = 0;
1022
1020
  } else {
1023
1021
  e->pos = at;
1024
1022
  }
@@ -1050,8 +1048,8 @@ static int e_block_scalar(yep_engine* e, yep_event* ev, int parent_col) {
1050
1048
  e->pos = at + br;
1051
1049
  e->line++;
1052
1050
  e->line_start = e->pos;
1053
- e->li_cache_line = 0;
1054
- e->shape_cache_line = 0;
1051
+ e->memo_line = 0;
1052
+ e->shape_line = 0;
1055
1053
  } else {
1056
1054
  e->pos = at;
1057
1055
  }
@@ -1961,9 +1959,8 @@ static int e_flow_node(yep_engine* e, yep_event* ev, int keyish) {
1961
1959
  e->pos += br;
1962
1960
  e->line++;
1963
1961
  e->line_start = e->pos;
1964
- e->li_cache_line = 0;
1965
- e->shape_cache_line = 0;
1966
- e->facts_cache_line = 0;
1962
+ e->memo_line = 0;
1963
+ e->shape_line = 0;
1967
1964
  if (e->pos >= e->len) {
1968
1965
  ended = 1;
1969
1966
  break;
@@ -5928,9 +5925,8 @@ static int engine_run_impl(yep_engine* e, const char* buf, size_t len, const yep
5928
5925
  e->line = 1 + e->line_base;
5929
5926
  e->line_base = 0;
5930
5927
  e->line_start = 0;
5931
- e->li_cache_line = 0;
5932
- e->shape_cache_line = 0;
5933
- e->facts_cache_line = 0;
5928
+ e->memo_line = 0;
5929
+ e->shape_line = 0;
5934
5930
  e->depth = 0;
5935
5931
  yep_nametab_clear(&e->anchors);
5936
5932
  if (e->anchor_placed != NULL) {
@@ -204,6 +204,16 @@ int yep_scan_dq_forced(const char* p, uint32_t len) {
204
204
  return 0;
205
205
  }
206
206
 
207
+ int yep_scan_json_clean(const char* p, uint32_t len) {
208
+ for (uint32_t k = 0; k < len; k++) {
209
+ unsigned char c = (unsigned char)p[k];
210
+ if (c < 0x20 || c == '"' || c == '\\') {
211
+ return 0;
212
+ }
213
+ }
214
+ return 1;
215
+ }
216
+
207
217
  /* ---- the plain-safety truth table (moved from emit/style.c,
208
218
  * #352 lane 3: scan owns bytes→facts; the emitter and the DOM's
209
219
  * parse-time fact bit both read THIS walk so they cannot drift) ---- */
@@ -115,6 +115,13 @@ int yep_scan_dq_forced(const char* p, uint32_t len);
115
115
  * rejects; mid-token BOMs ride). */
116
116
  int yep_scan_plain_safe(const char* p, uint32_t len);
117
117
 
118
+ /* The JSON-clean fact (#739): 1 when the span carries no byte that
119
+ * emit_dq_json escapes — '"' (0x22), '\\' (0x5c), or C0 (0x00-0x1f).
120
+ * DEL and every non-ASCII byte ride raw in JSON, so they stay clean.
121
+ * One home for the JSON builder's parse-time fact bit AND any
122
+ * emit-side re-check, so the verdicts cannot drift. */
123
+ int yep_scan_json_clean(const char* p, uint32_t len);
124
+
118
125
  /* Tag-shorthand suffix byte: libyaml's URI set (";/?:@&=+$,_.!~*'()%"
119
126
  * plus alphanumerics; flow indicators and ',' terminate instead).
120
127
  * Stray non-set bytes stay visible as the props follower, which
@@ -57,11 +57,17 @@ static int rec_put(tape_ctx* c, uint8_t kind, uint32_t off, uint32_t len) {
57
57
  return 1;
58
58
  }
59
59
 
60
- static YeptrisStatus tape_carve(yeptris_json_tape* t, size_t len) {
60
+ static YeptrisStatus tape_carve(yeptris_json_tape* t, size_t len, int with_recs) {
61
61
  size_t cap = len + 2;
62
62
  size_t off_o = (cap + 15) & ~(size_t)15;
63
- char* block = yep_alloc(yep_system_allocator(),
64
- off_o + 2 * cap * sizeof(uint32_t) + cap * sizeof(yeptris_tape_rec));
63
+ /* with_recs=0 (every column-built route): the interleaved record
64
+ * region is not allocated at all — the strict route never touches
65
+ * it, and carrying it made the block 17 bytes per input byte (the
66
+ * #474 profile's madvise lane rode the free of the unused 8).
67
+ * recs == NULL is the documented column-primary shape (tape.h). */
68
+ char* block =
69
+ yep_alloc(yep_system_allocator(), off_o + 2 * cap * sizeof(uint32_t) +
70
+ (with_recs ? cap * sizeof(yeptris_tape_rec) : 0));
65
71
  if (block == NULL) {
66
72
  return YEPTRIS_ERROR_MEMORY;
67
73
  }
@@ -69,7 +75,7 @@ static YeptrisStatus tape_carve(yeptris_json_tape* t, size_t len) {
69
75
  t->kinds = (uint8_t*)block;
70
76
  t->offs = (uint32_t*)(void*)(block + off_o);
71
77
  t->lens = t->offs + cap;
72
- t->recs = (yeptris_tape_rec*)(void*)(t->lens + cap);
78
+ t->recs = with_recs ? (yeptris_tape_rec*)(void*)(t->lens + cap) : NULL;
73
79
  t->count = 0;
74
80
  t->int_min = 0;
75
81
  t->_rec_primary = 0;
@@ -161,7 +167,7 @@ static inline uint8_t tape_inline_punct(const char* p, size_t len, size_t* i, ui
161
167
 
162
168
  static YeptrisStatus tape_walk(const char* p, size_t len, size_t open, yeptris_json_tape* t,
163
169
  int check_tail) {
164
- if (tape_carve(t, len) != YEPTRIS_OK) {
170
+ if (tape_carve(t, len, 0) != YEPTRIS_OK) {
165
171
  return YEPTRIS_ERROR_MEMORY;
166
172
  }
167
173
  uint8_t* kinds = t->kinds;
@@ -388,7 +394,7 @@ reject:
388
394
  static YEP_UNUSED_FN YeptrisStatus tape_walk_idx(const char* p, size_t len, size_t open,
389
395
  const uint32_t* idx, size_t nidx,
390
396
  yeptris_json_tape* t) {
391
- if (tape_carve(t, len) != YEPTRIS_OK) {
397
+ if (tape_carve(t, len, 0) != YEPTRIS_OK) {
392
398
  return YEPTRIS_ERROR_MEMORY;
393
399
  }
394
400
  uint8_t* kinds = t->kinds;
@@ -765,7 +771,7 @@ YeptrisStatus yep_tape_walk_lenient_fused(const char* p, size_t len, size_t open
765
771
  t->_rec_primary = 1;
766
772
  t->_long_key_known = 0;
767
773
  t->_long_key = 0;
768
- } else if (tape_carve(t, len) != YEPTRIS_OK) {
774
+ } else if (tape_carve(t, len, 1) != YEPTRIS_OK) {
769
775
  return YEPTRIS_ERROR_MEMORY;
770
776
  }
771
777
  t->_rec_primary = 1;
@@ -869,7 +875,6 @@ YeptrisStatus yep_tape_walk_lenient_fused(const char* p, size_t len, size_t open
869
875
  #define LSTR_SCAN(after) \
870
876
  do { \
871
877
  size_t j_ = i + 1; \
872
- int esc_ = 0; \
873
878
  if (j_ + 8 <= len) { \
874
879
  uint64_t w_; \
875
880
  memcpy(&w_, p + j_, 8); \
@@ -922,6 +927,7 @@ YeptrisStatus yep_tape_walk_lenient_fused(const char* p, size_t len, size_t open
922
927
  } \
923
928
  { \
924
929
  const yep_text_kernels* kk_ = yep_text_active(); \
930
+ int esc_ = 0; \
925
931
  ptrdiff_t r_ = kk_->quote_scan(p + j_, len - j_, '"', &esc_); \
926
932
  if (r_ >= 0 && esc_ == 0) { \
927
933
  size_t cl_ = j_ + (size_t)r_; \
@@ -956,6 +962,7 @@ YeptrisStatus yep_tape_walk_lenient_fused(const char* p, size_t len, size_t open
956
962
  { \
957
963
  size_t at_ = i; \
958
964
  size_t cl_ = 0; \
965
+ int esc_ = 0; \
959
966
  if (!yep_json_string(p, len, &i, &cl_, &esc_)) { \
960
967
  goto lreject; \
961
968
  } \
@@ -1344,7 +1351,7 @@ static YeptrisStatus yep_tape_walk_columns_fused(const char* p, size_t len, size
1344
1351
  * at the lenient lane's memory traffic. The record walk stays
1345
1352
  * byte-identical beside it; the differential suites pin the
1346
1353
  * equivalence. */
1347
- if (tape_carve(t, len) != YEPTRIS_OK) {
1354
+ if (tape_carve(t, len, 0) != YEPTRIS_OK) {
1348
1355
  return YEPTRIS_ERROR_MEMORY;
1349
1356
  }
1350
1357
  uint8_t* kinds = t->kinds;
@@ -1451,7 +1458,6 @@ static YeptrisStatus yep_tape_walk_columns_fused(const char* p, size_t len, size
1451
1458
  #define LSTR_SCAN(after) \
1452
1459
  do { \
1453
1460
  size_t j_ = i + 1; \
1454
- int esc_ = 0; \
1455
1461
  if (j_ + 8 <= len) { \
1456
1462
  uint64_t w_; \
1457
1463
  memcpy(&w_, p + j_, 8); \
@@ -1505,6 +1511,7 @@ static YeptrisStatus yep_tape_walk_columns_fused(const char* p, size_t len, size
1505
1511
  } \
1506
1512
  { \
1507
1513
  const yep_text_kernels* kk_ = yep_text_active(); \
1514
+ int esc_ = 0; \
1508
1515
  ptrdiff_t r_ = kk_->quote_scan(p + j_, len - j_, '"', &esc_); \
1509
1516
  if (r_ >= 0 && esc_ == 0) { \
1510
1517
  size_t cl_ = j_ + (size_t)r_; \
@@ -1540,6 +1547,7 @@ static YeptrisStatus yep_tape_walk_columns_fused(const char* p, size_t len, size
1540
1547
  { \
1541
1548
  size_t at_ = i; \
1542
1549
  size_t cl_ = 0; \
1550
+ int esc_ = 0; \
1543
1551
  if (!yep_json_string(p, len, &i, &cl_, &esc_)) { \
1544
1552
  goto lreject; \
1545
1553
  } \
@@ -1868,7 +1876,7 @@ lreject:
1868
1876
  static YEP_UNUSED_FN YeptrisStatus tape_walk_lnt(const char* p, size_t len, size_t open,
1869
1877
  const uint32_t* idx, size_t nidx,
1870
1878
  yeptris_json_tape* t) {
1871
- if (tape_carve(t, len) != YEPTRIS_OK) {
1879
+ if (tape_carve(t, len, 0) != YEPTRIS_OK) {
1872
1880
  return YEPTRIS_ERROR_MEMORY;
1873
1881
  }
1874
1882
  uint8_t* kinds = t->kinds;
@@ -2141,7 +2149,7 @@ YEPTRIS_API YeptrisStatus yeptris_parse_json_tape_lenient(const char* source, si
2141
2149
  }
2142
2150
 
2143
2151
  /* scalar root: one record, same deferred split for numbers */
2144
- if (tape_carve(tape, len) != YEPTRIS_OK) {
2152
+ if (tape_carve(tape, len, 0) != YEPTRIS_OK) {
2145
2153
  return YEPTRIS_ERROR_MEMORY;
2146
2154
  }
2147
2155
  tape->_src = source;
@@ -2309,7 +2317,7 @@ YEPTRIS_API YeptrisStatus yeptris_parse_json_tape(const char* source, size_t len
2309
2317
  "tape walk rejected a validated document at byte %zu", at);
2310
2318
  return YEPTRIS_ERROR_INTERNAL;
2311
2319
  }
2312
- if (tape_carve(tape, len) != YEPTRIS_OK) {
2320
+ if (tape_carve(tape, len, 0) != YEPTRIS_OK) {
2313
2321
  return YEPTRIS_ERROR_MEMORY;
2314
2322
  }
2315
2323
  tape->_src = source;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.65.0
4
+ version: 0.6.66.0
5
5
  platform: riscv64-linux-gnu
6
6
  authors:
7
7
  - Ribose Inc.