yeptris 0.6.60.1-arm-linux-eabihf → 0.6.62.1-arm-linux-eabihf
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.
- checksums.yaml +4 -4
- data/ext/yeptris_native/version.h +2 -2
- data/lib/yeptris/3.4/native.so +0 -0
- data/lib/yeptris/document.rb +4 -1
- data/lib/yeptris/psych.rb +9 -6
- data/lib/yeptris/yaml.rb +15 -3
- data/lib/yeptris.rb +1 -1
- data/libyeptris.so +0 -0
- data/vendor/libyeptris/CMakeLists.txt +1 -1
- data/vendor/libyeptris/src/include/yeptris/emit.h +24 -18
- data/vendor/libyeptris/src/include/yeptris/parse.h +21 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text.h +14 -1
- data/vendor/libyeptris/src/yeptris/common/simd_text_avx2.c +55 -2
- data/vendor/libyeptris/src/yeptris/common/simd_text_neon.c +59 -2
- data/vendor/libyeptris/src/yeptris/common/simd_text_scalar.c +24 -2
- data/vendor/libyeptris/src/yeptris/dom/dom.c +12 -1
- data/vendor/libyeptris/src/yeptris/dom/ytape.c +56 -7
- data/vendor/libyeptris/src/yeptris/emit/emit.c +44 -18
- data/vendor/libyeptris/src/yeptris/emit/writer.c +110 -19
- data/vendor/libyeptris/src/yeptris/emit/writer.h +10 -7
- data/vendor/libyeptris/src/yeptris/events/values.c +22 -0
- data/vendor/libyeptris/src/yeptris/parse/engine.c +490 -90
- data/vendor/libyeptris/src/yeptris/parse/engine.h +5 -0
- data/vendor/libyeptris/src/yeptris/parse/stream_iter.c +33 -1
- data/vendor/libyeptris/src/yeptris/parse.c +43 -1
- data/vendor/libyeptris/src/yeptris/resolve/compat11.c +2 -5
- data/vendor/libyeptris/src/yeptris/resolve/resolver.h +18 -0
- data/vendor/libyeptris/src/yeptris/resolve/tags.c +192 -0
- data/vendor/libyeptris/src/yeptris/scan/scan.c +87 -12
- data/vendor/libyeptris/src/yeptris/tape.c +24 -5
- metadata +1 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Two passes of the ONE writer: dry (exact size), wet (linear writes
|
|
4
4
|
* into the caller's buffer — zero reallocations by construction). */
|
|
5
5
|
|
|
6
|
+
#include <limits.h>
|
|
6
7
|
#include <stddef.h>
|
|
7
8
|
#include <stdlib.h>
|
|
8
9
|
#include <string.h>
|
|
@@ -23,12 +24,40 @@ static int opts_canonical(const yeptris_emit_options* opts) {
|
|
|
23
24
|
opts->canonical;
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
static int opts_indent(const yeptris_emit_options* opts) {
|
|
28
|
+
/* size-versioned (#903); out of range rides the default (libyaml
|
|
29
|
+
* clamps 2..9 the same way) */
|
|
30
|
+
int ind = 2;
|
|
31
|
+
if (opts != NULL &&
|
|
32
|
+
opts->size >= (uint32_t)(offsetof(yeptris_emit_options, best_indent) + sizeof(int))) {
|
|
33
|
+
ind = opts->best_indent;
|
|
34
|
+
}
|
|
35
|
+
if (ind < 2 || ind > 9) {
|
|
36
|
+
ind = 2;
|
|
37
|
+
}
|
|
38
|
+
return ind;
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
static int opts_width(const yeptris_emit_options* opts) {
|
|
42
|
+
/* libyaml's emitter-init clamp, spelled per the caller's declared
|
|
43
|
+
* width (#1257): `best_width < 0` means NEVER fold — Psych's
|
|
44
|
+
* `line_width: -1` unwrap, applied to the flow wrap and the block
|
|
45
|
+
* fold alike; `0 <= best_width <= best_indent*2` snaps to 80
|
|
46
|
+
* (libyaml's too-narrow clamp); absent or 0 rides the default 80. */
|
|
47
|
+
if (opts != NULL &&
|
|
48
|
+
opts->size >= (uint32_t)(offsetof(yeptris_emit_options, best_width) + sizeof(int)) &&
|
|
49
|
+
opts->best_width < 0) {
|
|
50
|
+
return INT_MAX;
|
|
51
|
+
}
|
|
52
|
+
int ind = opts_indent(opts);
|
|
27
53
|
if (opts == NULL ||
|
|
28
54
|
opts->size < (uint32_t)(offsetof(yeptris_emit_options, best_width) + sizeof(int)) ||
|
|
29
|
-
opts->best_width
|
|
55
|
+
opts->best_width == 0) {
|
|
30
56
|
return 80; /* libyaml best_width parity */
|
|
31
57
|
}
|
|
58
|
+
if (opts->best_width <= ind * 2) {
|
|
59
|
+
return 80; /* the too-narrow clamp (libyaml: w <= best_indent*2) */
|
|
60
|
+
}
|
|
32
61
|
return opts->best_width;
|
|
33
62
|
}
|
|
34
63
|
|
|
@@ -42,26 +71,15 @@ static int opts_doc_marker(const yeptris_emit_options* opts) {
|
|
|
42
71
|
return opts->explicit_doc_start != 0;
|
|
43
72
|
}
|
|
44
73
|
|
|
45
|
-
static int opts_indent(const yeptris_emit_options* opts) {
|
|
46
|
-
/* size-versioned (#903); out of range rides the default (libyaml
|
|
47
|
-
* clamps 2..9 the same way) */
|
|
48
|
-
int ind = 2;
|
|
49
|
-
if (opts != NULL &&
|
|
50
|
-
opts->size >= (uint32_t)(offsetof(yeptris_emit_options, best_indent) + sizeof(int))) {
|
|
51
|
-
ind = opts->best_indent;
|
|
52
|
-
}
|
|
53
|
-
if (ind < 2 || ind > 9) {
|
|
54
|
-
ind = 2;
|
|
55
|
-
}
|
|
56
|
-
return ind;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
74
|
static int opts_block_fold(const yeptris_emit_options* opts) {
|
|
60
|
-
/* size-versioned (#903):
|
|
61
|
-
*
|
|
75
|
+
/* size-versioned (#903, the #1257 flip): DEFAULT ON — block output
|
|
76
|
+
* folds at best_width like Psych/libyaml, so a host flipping
|
|
77
|
+
* engines never changes stored bytes by accident. An explicit
|
|
78
|
+
* block_fold = 0 (a caller passing the full struct) still
|
|
79
|
+
* unwraps, as does best_width < 0 (the width clamp). */
|
|
62
80
|
if (opts == NULL ||
|
|
63
81
|
opts->size < (uint32_t)(offsetof(yeptris_emit_options, block_fold) + sizeof(int))) {
|
|
64
|
-
return
|
|
82
|
+
return 1;
|
|
65
83
|
}
|
|
66
84
|
return opts->block_fold != 0;
|
|
67
85
|
}
|
|
@@ -112,6 +130,7 @@ YEPTRIS_API size_t yeptris_serialize_into_ex(YeptrisDocument handle,
|
|
|
112
130
|
em.w.col = 0;
|
|
113
131
|
em.w.sv_input = handle ? ((const yeptris_document*)handle)->dom->input_base : NULL;
|
|
114
132
|
em.w.sv_arena = handle ? ((const yeptris_document*)handle)->dom->str : NULL;
|
|
133
|
+
em.w.resolver = handle ? ((const yeptris_document*)handle)->dom->resolver : NULL;
|
|
115
134
|
em.w.sink = NULL;
|
|
116
135
|
em.w.watermark = 0;
|
|
117
136
|
em.w.sink_aborted = 0;
|
|
@@ -181,6 +200,7 @@ YEPTRIS_API size_t yeptris_serialize_into_trusted(YeptrisDocument handle,
|
|
|
181
200
|
em.w.col = 0;
|
|
182
201
|
em.w.sv_input = ((const yeptris_document*)handle)->dom->input_base;
|
|
183
202
|
em.w.sv_arena = ((const yeptris_document*)handle)->dom->str;
|
|
203
|
+
em.w.resolver = ((const yeptris_document*)handle)->dom->resolver;
|
|
184
204
|
em.w.sink = NULL;
|
|
185
205
|
em.w.watermark = 0;
|
|
186
206
|
em.w.sink_aborted = 0;
|
|
@@ -249,6 +269,7 @@ YEPTRIS_API char* yeptris_serialize_ex(YeptrisDocument handle, const yeptris_emi
|
|
|
249
269
|
em.w.col = 0;
|
|
250
270
|
em.w.sv_input = handle ? ((const yeptris_document*)handle)->dom->input_base : NULL;
|
|
251
271
|
em.w.sv_arena = handle ? ((const yeptris_document*)handle)->dom->str : NULL;
|
|
272
|
+
em.w.resolver = handle ? ((const yeptris_document*)handle)->dom->resolver : NULL;
|
|
252
273
|
em.w.sink = NULL;
|
|
253
274
|
em.w.watermark = 0;
|
|
254
275
|
em.w.sink_aborted = 0;
|
|
@@ -390,6 +411,7 @@ YEPTRIS_API char* yeptris_serialize_json(YeptrisDocument handle, size_t* len) {
|
|
|
390
411
|
em.w.col = 0;
|
|
391
412
|
em.w.sv_input = handle ? ((const yeptris_document*)handle)->dom->input_base : NULL;
|
|
392
413
|
em.w.sv_arena = handle ? ((const yeptris_document*)handle)->dom->str : NULL;
|
|
414
|
+
em.w.resolver = handle ? ((const yeptris_document*)handle)->dom->resolver : NULL;
|
|
393
415
|
em.w.sink = NULL;
|
|
394
416
|
em.w.watermark = 0;
|
|
395
417
|
em.w.sink_aborted = 0;
|
|
@@ -434,6 +456,7 @@ YEPTRIS_API char* yeptris_serialize_json_ex(YeptrisDocument handle, size_t* len,
|
|
|
434
456
|
em.w.col = 0;
|
|
435
457
|
em.w.sv_input = handle ? ((const yeptris_document*)handle)->dom->input_base : NULL;
|
|
436
458
|
em.w.sv_arena = handle ? ((const yeptris_document*)handle)->dom->str : NULL;
|
|
459
|
+
em.w.resolver = handle ? ((const yeptris_document*)handle)->dom->resolver : NULL;
|
|
437
460
|
em.w.sink = NULL;
|
|
438
461
|
em.w.watermark = 0;
|
|
439
462
|
em.w.sink_aborted = 0;
|
|
@@ -480,6 +503,7 @@ char* yep_serialize_json_compact(const yeptris_document* doc, size_t* len) {
|
|
|
480
503
|
em.w.col = 0;
|
|
481
504
|
em.w.sv_input = doc->dom->input_base;
|
|
482
505
|
em.w.sv_arena = doc->dom->str;
|
|
506
|
+
em.w.resolver = doc->dom->resolver;
|
|
483
507
|
em.w.sink = NULL;
|
|
484
508
|
em.w.watermark = 0;
|
|
485
509
|
em.w.sink_aborted = 0;
|
|
@@ -528,6 +552,7 @@ char* yep_serialize_json_pretty_ex(const yeptris_document* doc, size_t* len, con
|
|
|
528
552
|
em.w.col = 0;
|
|
529
553
|
em.w.sv_input = doc->dom->input_base;
|
|
530
554
|
em.w.sv_arena = doc->dom->str;
|
|
555
|
+
em.w.resolver = doc->dom->resolver;
|
|
531
556
|
em.w.sink = NULL;
|
|
532
557
|
em.w.watermark = 0;
|
|
533
558
|
em.w.sink_aborted = 0;
|
|
@@ -604,6 +629,7 @@ YEPTRIS_API size_t yeptris_serialize_stream(YeptrisDocument handle,
|
|
|
604
629
|
em.w.col = 0;
|
|
605
630
|
em.w.sv_input = handle ? ((const yeptris_document*)handle)->dom->input_base : NULL;
|
|
606
631
|
em.w.sv_arena = handle ? ((const yeptris_document*)handle)->dom->str : NULL;
|
|
632
|
+
em.w.resolver = handle ? ((const yeptris_document*)handle)->dom->resolver : NULL;
|
|
607
633
|
em.w.sink = sink;
|
|
608
634
|
em.w.sink_ctx = ctx;
|
|
609
635
|
em.w.watermark = YEP_EMIT_WATERMARK;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
#include "../scan/scan.h"
|
|
22
22
|
|
|
23
|
+
#include <limits.h>
|
|
23
24
|
#include <string.h>
|
|
24
25
|
|
|
25
26
|
#include "style.h"
|
|
@@ -539,7 +540,33 @@ static void emit_literal(yep_writer* w, const yep_dnode* n, int parent_col) {
|
|
|
539
540
|
/* Canonical scalar (13B): typed words and numbers plain, everything
|
|
540
541
|
* else double-quoted; floats re-print through the shortest printer so
|
|
541
542
|
* canonical output is a fixed point (parse of canonical re-prints
|
|
542
|
-
* identically — the byte-stability gate).
|
|
543
|
+
* identically — the byte-stability gate). The DOM stores only the tag
|
|
544
|
+
* + source text, so the typed arms re-derive the VALUE from the
|
|
545
|
+
* resolver's own tables (#937): the bool table decides true/false
|
|
546
|
+
* (the old length guess spelled every non-4-char true-word false), the
|
|
547
|
+
* int decode spells JSON-unspellable forms (0x1F/0o7) in decimal, and
|
|
548
|
+
* the inf/nan words ride quoted in JSON mode (no JSON infinity). */
|
|
549
|
+
static int json_int_token(const char* p, uint32_t n) {
|
|
550
|
+
/* the strict JSON int token: -?(0|[1-9][0-9]*) — leading zeros
|
|
551
|
+
* and a '+' are YAML-spellable but not JSON (those decode) */
|
|
552
|
+
uint32_t i = 0;
|
|
553
|
+
if (i < n && p[0] == '-') {
|
|
554
|
+
i = 1;
|
|
555
|
+
}
|
|
556
|
+
if (i >= n) {
|
|
557
|
+
return 0;
|
|
558
|
+
}
|
|
559
|
+
if (p[i] == '0') {
|
|
560
|
+
return i + 1 == n;
|
|
561
|
+
}
|
|
562
|
+
for (uint32_t k = i; k < n; k++) {
|
|
563
|
+
if (p[k] < '0' || p[k] > '9') {
|
|
564
|
+
return 0;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return 1;
|
|
568
|
+
}
|
|
569
|
+
|
|
543
570
|
static void emit_canonical_scalar(yep_writer* w, const yep_dnode* n) {
|
|
544
571
|
yep_view vdec = wv(w, n->value);
|
|
545
572
|
const char* p = (const char*)vdec.p;
|
|
@@ -553,17 +580,24 @@ static void emit_canonical_scalar(yep_writer* w, const yep_dnode* n) {
|
|
|
553
580
|
wr_put(w, "~", 1);
|
|
554
581
|
}
|
|
555
582
|
return;
|
|
556
|
-
case YEPTRIS_TAG_BOOL:
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
583
|
+
case YEPTRIS_TAG_BOOL: {
|
|
584
|
+
int bv = yep_tag_bool_value(p, len);
|
|
585
|
+
if (bv < 0) {
|
|
586
|
+
break; /* not a bool word: quoted (the resolver only
|
|
587
|
+
tags the table's words; defense) */
|
|
561
588
|
}
|
|
589
|
+
wr_put(w, bv ? "true" : "false", bv ? 4u : 5u);
|
|
562
590
|
return;
|
|
591
|
+
}
|
|
563
592
|
case YEPTRIS_TAG_FLOAT: {
|
|
564
593
|
const char* word = yep_tag_float_word(p, len);
|
|
565
594
|
if (word != NULL) {
|
|
566
|
-
|
|
595
|
+
uint32_t wl = (uint32_t)strlen(word);
|
|
596
|
+
if (w->json) {
|
|
597
|
+
emit_dq_json(w, word, wl);
|
|
598
|
+
} else {
|
|
599
|
+
wr_put(w, word, wl);
|
|
600
|
+
}
|
|
567
601
|
return;
|
|
568
602
|
}
|
|
569
603
|
char buf[40];
|
|
@@ -584,8 +618,23 @@ static void emit_canonical_scalar(yep_writer* w, const yep_dnode* n) {
|
|
|
584
618
|
break; /* unparseable view: fall through to quoting */
|
|
585
619
|
}
|
|
586
620
|
case YEPTRIS_TAG_INT:
|
|
587
|
-
|
|
588
|
-
|
|
621
|
+
if (!w->json || json_int_token(p, len)) {
|
|
622
|
+
/* YAML keeps the source text (stable, lossless); JSON
|
|
623
|
+
* keeps JSON-number-shaped text (big ints stay exact) */
|
|
624
|
+
wr_put(w, p, len);
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
{
|
|
628
|
+
int compat = w->resolver == yep_resolver_compat11();
|
|
629
|
+
int64_t v;
|
|
630
|
+
if (yep_tag_int64(p, len, compat, &v) == 0) {
|
|
631
|
+
char buf[24];
|
|
632
|
+
int nl = snprintf(buf, sizeof buf, "%lld", (long long)v);
|
|
633
|
+
wr_put(w, buf, (uint32_t)nl);
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
break; /* undecodable int text: quoted keeps JSON valid */
|
|
589
638
|
default:
|
|
590
639
|
break;
|
|
591
640
|
}
|
|
@@ -1284,20 +1333,35 @@ static void emit_block_map(yep_emitter* em, uint32_t id, int content_col) {
|
|
|
1284
1333
|
* the exact predicates sc_route consults (no memo touch, so
|
|
1285
1334
|
* the dry/wet sc_i streams stay aligned). Anything else falls
|
|
1286
1335
|
* through untouched — parity by construction. block_fold
|
|
1287
|
-
* (#903) declines the
|
|
1288
|
-
*
|
|
1289
|
-
*
|
|
1336
|
+
* (#903) declines only the members folding can actually
|
|
1337
|
+
* touch (#1257): the fold walk breaks exclusively at an
|
|
1338
|
+
* interior space whose column passes best_width, so a member
|
|
1339
|
+
* is fold-inert — the fused write stays byte-identical —
|
|
1340
|
+
* when folding is off, the width is the unwrap INT_MAX, the
|
|
1341
|
+
* value carries no space at all, or the member line ends
|
|
1342
|
+
* within the width. Fold-possible members fall through to
|
|
1343
|
+
* the general body, which folds. */
|
|
1290
1344
|
const yep_dnode* kn0 = yep_dom_node(d, child);
|
|
1291
1345
|
const yep_dnode* vn0 = yep_dom_node(d, kn0->next_sibling);
|
|
1292
|
-
if (!w->canonical && !w->json && !w->force_flow &&
|
|
1293
|
-
kn0->
|
|
1294
|
-
|
|
1295
|
-
vn0->
|
|
1346
|
+
if (!w->canonical && !w->json && !w->force_flow && vn0 != NULL && kn0->kind == 0 &&
|
|
1347
|
+
kn0->style == 1 && kn0->anchor.len == 0 && kn0->tag.len == 0 && kn0->count == 0 &&
|
|
1348
|
+
vn0->kind == 0 && vn0->style == 1 && vn0->anchor.len == 0 && vn0->tag.len == 0 &&
|
|
1349
|
+
vn0->count == 0) {
|
|
1296
1350
|
yep_view kv = wv(w, kn0->value);
|
|
1297
1351
|
yep_view vv = wv(w, vn0->value);
|
|
1352
|
+
/* the member's start column: after a written newline the
|
|
1353
|
+
* cursor rides the indent (content_col); otherwise the
|
|
1354
|
+
* live column (the first member: the caller placed the
|
|
1355
|
+
* cursor at content_col) */
|
|
1356
|
+
int m_start = (pair == 0 || w->last == '\n') ? content_col : w->col;
|
|
1357
|
+
/* the empty value's view is {NULL, 0} (wv) — memchr's
|
|
1358
|
+
* nonnull contract forbids the probe even at len 0 */
|
|
1359
|
+
int fold_inert = !w->block_fold || w->best_width == INT_MAX || vv.p == NULL ||
|
|
1360
|
+
memchr(vv.p, ' ', vv.len) == NULL ||
|
|
1361
|
+
m_start + (int)kv.len + (int)vv.len + 2 <= w->best_width;
|
|
1298
1362
|
uint32_t f_ind = 0, f_nl = 0, f_total = 0;
|
|
1299
|
-
int fused = kv.len > 0 && !key_written_over_limit(w, kn0) &&
|
|
1300
|
-
(vv.len == 0 || vn0->plain_ok);
|
|
1363
|
+
int fused = fold_inert && kv.len > 0 && !key_written_over_limit(w, kn0) &&
|
|
1364
|
+
kn0->plain_ok && (vv.len == 0 || vn0->plain_ok);
|
|
1301
1365
|
if (fused) {
|
|
1302
1366
|
/* fused member write: plain-safe spans carry no breaks,
|
|
1303
1367
|
* so the col scan is arithmetic and one reservation
|
|
@@ -1602,6 +1666,24 @@ static void emit_node(yep_emitter* em, uint32_t id, int parent_col, int as_key)
|
|
|
1602
1666
|
}
|
|
1603
1667
|
emit_tag(w, n);
|
|
1604
1668
|
emit_anchor_ex(em, n);
|
|
1669
|
+
if (parent_col < 0 && !w->canonical && !w->json && n->kind == 0 && n->style <= 1) {
|
|
1670
|
+
/* A DOCUMENT-ROOT empty scalar rides the quoted form: libyaml
|
|
1671
|
+
* renders "--- ''" and never a bare marker with nothing after
|
|
1672
|
+
* it. A plain-empty root emitted as NOTHING (the value law of
|
|
1673
|
+
* issue #290, "k:" — kept below for non-root contexts) sheds
|
|
1674
|
+
* the root node entirely; the re-parse of that stream produced
|
|
1675
|
+
* an ANY-styled empty root whose render is "" — and the bytes
|
|
1676
|
+
* diverged on round two (the nightly's r201 fuzz_roundtrip
|
|
1677
|
+
* byte-instability catch, ">\n! \n !<aaa: bbb\n...\n<NEL><NEL>",
|
|
1678
|
+
* whose second document's break-only content parses to a
|
|
1679
|
+
* plain-empty root). Quoting the root's emptiness makes every
|
|
1680
|
+
* empty-root spelling converge on the same fixpoint bytes. */
|
|
1681
|
+
yep_view vdec = wv(w, n->value);
|
|
1682
|
+
if (vdec.len == 0) {
|
|
1683
|
+
emit_dq(w, (const char*)vdec.p, vdec.len);
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1605
1687
|
if (parent_col < 0) {
|
|
1606
1688
|
parent_col = 0; /* root scalar: block body at column 2 */
|
|
1607
1689
|
}
|
|
@@ -1755,7 +1837,16 @@ size_t yep_emit_run(yep_emitter* em, int dry) {
|
|
|
1755
1837
|
yep_view tdec3 = wv(w, root->tag);
|
|
1756
1838
|
wr_tag_token(w, &tdec3);
|
|
1757
1839
|
}
|
|
1758
|
-
if (root->anchor.len > 0) {
|
|
1840
|
+
if (root->anchor.len > 0 && !anchor_name_unspellable(w, root)) {
|
|
1841
|
+
/* the r235 law: the lead line writes the name UNQUOTED
|
|
1842
|
+
* and anchor names have no quoting -- a name the spell
|
|
1843
|
+
* law rejects has no safe lead-line spelling. The r235
|
|
1844
|
+
* nightly's riding-colon names ("&:" and the artifact's
|
|
1845
|
+
* "&k:\"" — run 42739927952, crash-5de6f9ff) re-parsed
|
|
1846
|
+
* as an anchored empty KEY of the follow-on collection
|
|
1847
|
+
* (the anchor lost, s1 != s2, byte growth); the
|
|
1848
|
+
* colon-tail law fails the serialize like every other
|
|
1849
|
+
* anchor write path (the r228 "&: |" law) */
|
|
1759
1850
|
if (root->tag.len > 0) {
|
|
1760
1851
|
wr_byte(w, ' '); /* props need the separator */
|
|
1761
1852
|
}
|
|
@@ -69,13 +69,16 @@ typedef struct yep_writer {
|
|
|
69
69
|
* grow/flush checks run once per refill instead of once per byte;
|
|
70
70
|
* 0 at run entry and whenever the guarantee lapses. */
|
|
71
71
|
size_t reserve;
|
|
72
|
-
int in_flow;
|
|
73
|
-
|
|
74
|
-
int flow_item;
|
|
75
|
-
|
|
76
|
-
int unserializable;
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
int in_flow; /* scalars inside flow collections: plain must drop
|
|
73
|
+
',', '[', ']', '{', '}' — flow terminators */
|
|
74
|
+
int flow_item; /* the NEXT scalar is a flow-SEQ item: a null must
|
|
75
|
+
emit '~' (a bare nothing reads as "[, x]") */
|
|
76
|
+
int unserializable; /* an anchor name that cannot ride raw in flow
|
|
77
|
+
context: the document has no safe spelling —
|
|
78
|
+
serialize fails rather than corrupt */
|
|
79
|
+
const struct yep_resolver* resolver; /* the document's implicit-typing
|
|
80
|
+
family (NULL = core12): the INT arm's decode needs the family's
|
|
81
|
+
own forms (leading-0 is octal in compat, decimal in core) */
|
|
79
82
|
} yep_writer;
|
|
80
83
|
|
|
81
84
|
typedef struct yep_emitter {
|
|
@@ -452,6 +452,28 @@ int yep_values_from_input(const char* yaml, size_t len, int schema_compat, yep_v
|
|
|
452
452
|
}
|
|
453
453
|
/* fall through: engine */
|
|
454
454
|
}
|
|
455
|
+
/* Unicode breaks (NEL/LS/PS) normalize to '\n' BEFORE the
|
|
456
|
+
* engine, exactly as the parse entry's front-end does
|
|
457
|
+
* (parse_frontend): this drain feeds the SAME compat-grammar
|
|
458
|
+
* engine, and a raw NEL it never normalized errors where
|
|
459
|
+
* parse accepts -- the nightly's round 239 roundtrip catch
|
|
460
|
+
* ("<NEL>...<NEL> >\n <NEL>...<NEL>\nt": marshal returned
|
|
461
|
+
* ERROR_PARSE on a document yeptris_parse_ex accepted and
|
|
462
|
+
* serialized cleanly). JSON stays above this: the JSON reader
|
|
463
|
+
* keeps U+0085 raw inside strings, only the YAML reader
|
|
464
|
+
* normalizes (the parse_frontend law). Ownership rides the
|
|
465
|
+
* same `transcoded` plumbing the transcode above installed. */
|
|
466
|
+
{
|
|
467
|
+
size_t nlen = 0;
|
|
468
|
+
int kept_raw = 0;
|
|
469
|
+
char* norm = yep_engine_normalize_breaks(sys, data, data_len, &nlen, &kept_raw);
|
|
470
|
+
if (norm != NULL) {
|
|
471
|
+
yep_free(sys, transcoded);
|
|
472
|
+
transcoded = (unsigned char*)norm;
|
|
473
|
+
data = (const char*)norm;
|
|
474
|
+
data_len = nlen;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
455
477
|
yep_engine* eng = yep_engine_create(yep_system_allocator());
|
|
456
478
|
if (eng == NULL) {
|
|
457
479
|
return -1;
|