yeptris 0.6.59.1-arm-linux-eabihf → 0.6.61.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/ext/yeptris_native/version.h +2 -2
  3. data/lib/yeptris/3.4/native.so +0 -0
  4. data/lib/yeptris/ffi.rb +19 -0
  5. data/lib/yeptris/yaml.rb +71 -0
  6. data/lib/yeptris.rb +1 -1
  7. data/libyeptris.so +0 -0
  8. data/vendor/libyeptris/CMakeLists.txt +1 -1
  9. data/vendor/libyeptris/src/CMakeLists.txt +7 -0
  10. data/vendor/libyeptris/src/include/yeptris/emit.h +30 -2
  11. data/vendor/libyeptris/src/include/yeptris/parse.h +73 -0
  12. data/vendor/libyeptris/src/include/yeptris/resolve.h +8 -0
  13. data/vendor/libyeptris/src/include/yeptris/validate.h +222 -21
  14. data/vendor/libyeptris/src/include/yeptris/values.h +8 -2
  15. data/vendor/libyeptris/src/yeptris/cbor/cbor.h +10 -0
  16. data/vendor/libyeptris/src/yeptris/cbor/decode.c +5 -7
  17. data/vendor/libyeptris/src/yeptris/cbor/encode.c +9 -9
  18. data/vendor/libyeptris/src/yeptris/cbor/from_marshal.c +1 -1
  19. data/vendor/libyeptris/src/yeptris/common/error.h +2 -0
  20. data/vendor/libyeptris/src/yeptris/doc.h +20 -0
  21. data/vendor/libyeptris/src/yeptris/dom/dom.c +12 -1
  22. data/vendor/libyeptris/src/yeptris/dom/ytape.c +56 -7
  23. data/vendor/libyeptris/src/yeptris/emit/emit.c +93 -13
  24. data/vendor/libyeptris/src/yeptris/emit/writer.c +243 -652
  25. data/vendor/libyeptris/src/yeptris/emit/writer.h +25 -8
  26. data/vendor/libyeptris/src/yeptris/events/push.c +28 -3
  27. data/vendor/libyeptris/src/yeptris/events/values.c +46 -0
  28. data/vendor/libyeptris/src/yeptris/marshal/to_json.c +650 -0
  29. data/vendor/libyeptris/src/yeptris/parse/engine.c +611 -130
  30. data/vendor/libyeptris/src/yeptris/parse/engine.h +5 -0
  31. data/vendor/libyeptris/src/yeptris/parse/stream_iter.c +358 -0
  32. data/vendor/libyeptris/src/yeptris/parse.c +216 -44
  33. data/vendor/libyeptris/src/yeptris/resolve/compat11.c +3 -6
  34. data/vendor/libyeptris/src/yeptris/resolve/core12.c +11 -3
  35. data/vendor/libyeptris/src/yeptris/resolve/full12.c +201 -0
  36. data/vendor/libyeptris/src/yeptris/resolve/json12.c +12 -6
  37. data/vendor/libyeptris/src/yeptris/resolve/resolver.h +38 -0
  38. data/vendor/libyeptris/src/yeptris/resolve/tags.c +192 -0
  39. data/vendor/libyeptris/src/yeptris/scan/scan.c +22 -7
  40. data/vendor/libyeptris/src/yeptris/tape.c +24 -5
  41. data/vendor/libyeptris/src/yeptris/validate/compile.c +39 -3
  42. data/vendor/libyeptris/src/yeptris/validate/internal.h +223 -7
  43. data/vendor/libyeptris/src/yeptris/validate/jsonschema.c +645 -115
  44. data/vendor/libyeptris/src/yeptris/validate/output.c +246 -0
  45. data/vendor/libyeptris/src/yeptris/validate/regexp.c +623 -157
  46. data/vendor/libyeptris/src/yeptris/validate/registry.c +118 -0
  47. data/vendor/libyeptris/src/yeptris/validate/resources.c +601 -0
  48. data/vendor/libyeptris/src/yeptris/validate/stream.c +1155 -0
  49. data/vendor/libyeptris/src/yeptris/validate/validate.c +288 -145
  50. metadata +8 -1
@@ -38,7 +38,12 @@ typedef struct yep_writer {
38
38
  const char* json_indent; /* json_pretty indent unit; NULL = 2 spaces */
39
39
  int json_indent_len; /* json_pretty unit byte length */
40
40
  int best_width; /* 13B: 0 = default 80; flow lines wrap after a
41
- * value past this width */
41
+ * value past this width; with block_fold it is
42
+ * also the block scalar fold column (#903) */
43
+ int indent; /* #903: block indent per level (2..9, default
44
+ * 2): nested map content and seq item columns */
45
+ int block_fold; /* #903: plain/quoted block scalars fold at
46
+ * best_width (libyaml's plain-fold walk) */
42
47
  int col; /* current output column (wr_* maintains) */
43
48
  const char* sv_input; /* compact-view decode bases (dom regions) */
44
49
  const char* sv_arena;
@@ -64,13 +69,16 @@ typedef struct yep_writer {
64
69
  * grow/flush checks run once per refill instead of once per byte;
65
70
  * 0 at run entry and whenever the guarantee lapses. */
66
71
  size_t reserve;
67
- int in_flow; /* scalars inside flow collections: plain must drop
68
- ',', '[', ']', '{', '}' — flow terminators */
69
- int flow_item; /* the NEXT scalar is a flow-SEQ item: a null must
70
- emit '~' (a bare nothing reads as "[, x]") */
71
- int unserializable; /* an anchor name that cannot ride raw in flow
72
- context: the document has no safe spelling —
73
- serialize fails rather than corrupt */
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) */
74
82
  } yep_writer;
75
83
 
76
84
  typedef struct yep_emitter {
@@ -82,6 +90,15 @@ typedef struct yep_emitter {
82
90
  /* One pass over the document set. dry=1 counts exactly. */
83
91
  size_t yep_emit_run(yep_emitter* em, int dry);
84
92
 
93
+ /* The write primitives, shared with the marshal reader
94
+ * (marshal/to_json.c — the move keeps ONE writer engine; #904 item 5).
95
+ * Internal: never in a public header. */
96
+ void wr_col_update(yep_writer* w, const char* p, uint32_t n);
97
+ void wr_reserve(yep_writer* w, size_t need);
98
+ void wr_put(yep_writer* w, const char* p, uint32_t n);
99
+ void wr_byte(yep_writer* w, char c);
100
+ void emit_dq_json(yep_writer* w, const char* p, uint32_t n);
101
+
85
102
  /* Compact single-line JSON (internal entries for the json-c compat
86
103
  * layer's to_json_string forms). pretty selects json-c's
87
104
  * JSON_C_TO_STRING_PRETTY layout: newline + 2-space indent per
@@ -14,6 +14,10 @@
14
14
  typedef struct {
15
15
  yeptris_event_fn fn;
16
16
  void* ctx;
17
+ uint32_t abort_line; /* the mark of the event the callback aborted
18
+ * on: the abort-text law sets the channel AT
19
+ * the abort point, not at 0/0 */
20
+ uint32_t abort_col;
17
21
  } yep_push_ctx;
18
22
 
19
23
  static int push_on_event(void* ctx, const yep_event* ev) {
@@ -73,7 +77,14 @@ static int push_on_event(void* ctx, const yep_event* ev) {
73
77
  e.anchor_len = ev->anchor.len;
74
78
  e.tag = ev->tag.len > 0 ? (const char*)ev->tag.p : NULL;
75
79
  e.tag_len = ev->tag.len;
76
- return p->fn(p->ctx, &e);
80
+ int rc = p->fn(p->ctx, &e);
81
+ if (rc != 0) {
82
+ /* the abort point travels with the abort: the TLS slot's mark
83
+ * is where the walk stopped, not 0/0 (events.h's contract) */
84
+ p->abort_line = ev->line;
85
+ p->abort_col = ev->col;
86
+ }
87
+ return rc;
77
88
  }
78
89
 
79
90
  YEPTRIS_API YeptrisStatus yeptris_push_parse(const char* buf, size_t len, yeptris_event_fn on_event,
@@ -84,11 +95,17 @@ YEPTRIS_API YeptrisStatus yeptris_push_parse(const char* buf, size_t len, yeptri
84
95
  if (on_event == NULL) {
85
96
  return YEPTRIS_ERROR_ARG;
86
97
  }
98
+ /* the push run owns the channel for its duration: clearing at
99
+ * entry makes the abort-text law verifiable (the message a caller
100
+ * reads after a push is THIS run's verdict, never a stale one
101
+ * from an earlier operation on the thread — error.h promises ""
102
+ * after a success) */
103
+ yep_error_clear(yep_error_tls());
87
104
  yep_engine* eng = yep_engine_create(yep_system_allocator());
88
105
  if (eng == NULL) {
89
106
  return YEPTRIS_ERROR_MEMORY;
90
107
  }
91
- yep_push_ctx p = {on_event, ctx};
108
+ yep_push_ctx p = {on_event, ctx, 0, 0};
92
109
  yep_sink sink = {.on_event = push_on_event,
93
110
  .ctx = &p,
94
111
  .on_flow_build = NULL,
@@ -118,9 +135,17 @@ YEPTRIS_API YeptrisStatus yeptris_push_parse(const char* buf, size_t len, yeptri
118
135
  }
119
136
  /* the engine's own memory failures report MEMORY (the parse route's
120
137
  * law); the callback abort keeps its documented contract — a parse
121
- * stop, clean channel */
138
+ * stop with the last-error channel SET (#904 item 4, the
139
+ * abort-text law: the old code returned PARSE over a CLEAN slot,
140
+ * so yeptris_last_error served whatever stale message this thread's
141
+ * previous operation had left there). YEP_ERR_ABORTED carries the
142
+ * mark of the event the callback aborted on. */
122
143
  if (err_code == YEP_ERR_MEMORY) {
123
144
  return YEPTRIS_ERROR_MEMORY;
124
145
  }
146
+ if (err_code == YEP_ERR_NONE) {
147
+ yep_error_set(yep_error_tls(), YEP_ERR_ABORTED, p.abort_line, p.abort_col, 0,
148
+ "parse aborted by the event callback at %u:%u", p.abort_line, p.abort_col);
149
+ }
125
150
  return YEPTRIS_ERROR_PARSE;
126
151
  }
@@ -175,6 +175,15 @@ static int transform(yep_value_ctx* c, const yep_rec_store* store) {
175
175
  case YEPTRIS_EV_SEQUENCE_START:
176
176
  v.kind = YEP_V_SEQ_OPEN;
177
177
  v.tag_id = r->tag_id;
178
+ if (r->tag_len != 0) {
179
+ /* the collection's explicit tag text rides the opens'
180
+ * span fields (untagged containers keep off/len 0 —
181
+ * the arena is not touched on the hot path): a host
182
+ * constructor re-tags containers (!!set -> Python set,
183
+ * !!omap -> pairs) without a second drain */
184
+ v.off = yep_val_arena_put(c, ra + r->tag_off, r->tag_len);
185
+ v.len = r->tag_len;
186
+ }
178
187
  yep_val_slot(c, &v);
179
188
  yep_val_put(c, &v);
180
189
  if (c->depth < YEP_V_MAX_DEPTH) {
@@ -186,6 +195,11 @@ static int transform(yep_value_ctx* c, const yep_rec_store* store) {
186
195
  case YEPTRIS_EV_MAPPING_START:
187
196
  v.kind = YEP_V_MAP_OPEN;
188
197
  v.tag_id = r->tag_id;
198
+ if (r->tag_len != 0) {
199
+ /* the set/omap tag text, exactly as the SEQ arm above */
200
+ v.off = yep_val_arena_put(c, ra + r->tag_off, r->tag_len);
201
+ v.len = r->tag_len;
202
+ }
189
203
  yep_val_slot(c, &v);
190
204
  yep_val_put(c, &v);
191
205
  if (c->depth < YEP_V_MAX_DEPTH) {
@@ -293,6 +307,16 @@ static int lin_node(yep_value_ctx* c, const yep_dom* d, uint32_t id) {
293
307
  }
294
308
  v.kind = n->kind == YEP_DOM_SEQUENCE ? YEP_V_SEQ_OPEN : YEP_V_MAP_OPEN;
295
309
  v.tag_id = n->tag_id;
310
+ if (n->tag.len != 0) {
311
+ /* route parity with the engine transform: the opens' span
312
+ * fields carry the explicit tag text there, so the linearizer
313
+ * must too (the routes stay byte-identical — values_priv.h's
314
+ * law). Marshal bails on tagged subtrees before this matters
315
+ * (#178); strict JSON carries no tags. */
316
+ yep_view tv = yep_dom_view(d, n->tag);
317
+ v.off = yep_val_arena_put(c, tv.p, (uint32_t)tv.len);
318
+ v.len = (uint32_t)tv.len;
319
+ }
296
320
  yep_val_slot(c, &v);
297
321
  yep_val_put(c, &v);
298
322
  if (c->depth < YEP_V_MAX_DEPTH) {
@@ -428,6 +452,28 @@ int yep_values_from_input(const char* yaml, size_t len, int schema_compat, yep_v
428
452
  }
429
453
  /* fall through: engine */
430
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
+ }
431
477
  yep_engine* eng = yep_engine_create(yep_system_allocator());
432
478
  if (eng == NULL) {
433
479
  return -1;