yeptris 0.6.29.1-aarch64-linux → 0.6.30.1-aarch64-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24ab6f38bf874cdb334f4af245e30cbef171bef5955faad1f0da36ccab39a456
4
- data.tar.gz: 55b76ab2b1bac1685c4b7f5509954e55361df098173ff9c3b5a04b412e5c3ce9
3
+ metadata.gz: ed21b6413edbb75ee5d6fefb6154ee5dfac0fe19b15d8bacc9e400bb6eab586a
4
+ data.tar.gz: 983345beecb08f210ce43b79216c7c738df2a65f616aed7e2a04cd366a1bcbed
5
5
  SHA512:
6
- metadata.gz: cd7bfbe903b0ade9acd9287be382f85bd60029c4642793ef3b674c1e6712efafa5266e3ef12ab8c60b33eee51674054e13b88f8b7c4c9859f14f4a72e1a26770
7
- data.tar.gz: 81e70959d894ac9a0638340f2156bf42c29cdced4923bf14ebd6913eb7967ec3c917db1717d2340dcab7d1a5a614e5e7d31dbf60fb2d27c82c2458fdf62dfff4
6
+ metadata.gz: 01bdfe0f47e093d0489d4955beb28bc1a11951dc9e80c1cd3e83e78a3233c0f5e523dafc122e82c34352dec3e70b94e9906d7a8ae3f347ac0dbb14f9732a9654
7
+ data.tar.gz: 50b82fd35b986642fabe982f8074380aec859e969d7292f8a544fefb261d9abcc01a40f2f184c49f8cd2b3ffe04d04cc44f31e556776e34fda7cb3f50cb63789
data/lib/yeptris/yaml.rb CHANGED
@@ -269,12 +269,16 @@ module Yeptris
269
269
  return false if "-?:".include?(c) && (s.length == 1 || s[1] =~ /[ \t]/)
270
270
  return false if s.include?(": ") || s.end_with?(":") || s.include?(" #")
271
271
  return false if RESHAPES_SET[s]
272
- # compat's float grammar REQUIRES the dot ("1e3" re-reads as a
273
- # String and may dump plain); ints/sexagesimals still reshape.
274
- # psych's FLOAT has no trailing [.:] group — "1.2.3" is a
275
- # String and dumps plain (pinned by spec/yaml_spec.rb)
276
- return false if s.match?(/\A[-+]?(0|[1-9][0-9_]*)(:[0-5]?[0-9])+\z/)
272
+ # ints/sexagesimals reshape: the compat resolver accepts any
273
+ # digit start (compat11.c), psych's ScalarScanner likewise —
274
+ # "07:00:00" plain re-reads as Integer, so leading-zero hours
275
+ # quote too (psych dumps them quoted)
276
+ return false if s.match?(/\A[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+\z/)
277
277
  return false if s.match?(/\A[-+]?(0|[1-9][0-9_]*)\z/)
278
+ # compat's float grammar REQUIRES the dot ("1e3" re-reads as a
279
+ # String and may dump plain); psych's FLOAT has no trailing
280
+ # [.:] group — "1.2.3" is a String and dumps plain (pinned by
281
+ # spec/yaml_spec.rb)
278
282
  return false if s.match?(/\A[-+]?[0-9][0-9_]*\.[0-9_]*([eE][-+]?[0-9]+)?\z/)
279
283
  return false if s.match?(/\A[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+\.[0-9_]*\z/)
280
284
  return false if s.match?(/\A[-+]?(0x[0-9a-fA-F_]+|0b[01_]+|0o?[0-7_]+)\z/)
data/lib/yeptris.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Yeptris
4
4
  # The gem's version lives in the parent namespace's file — the last
5
5
  # internal require (yeptris/version) retired with it.
6
- VERSION = "0.6.29.1".freeze
6
+ VERSION = "0.6.30.1".freeze
7
7
 
8
8
  # Informational notices are OPT-IN (yeptris-ruby#217): consumers
9
9
  # embed yeptris inside CLIs that assert clean stderr, and a
data/libyeptris.so CHANGED
Binary file
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(yeptris
6
- VERSION 0.6.29
6
+ VERSION 0.6.30
7
7
  DESCRIPTION "Ultra-fast YAML 1.2 parser, emitter and streamer in C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -206,10 +206,20 @@ endif()
206
206
  # config; relative paths keep relocatable installs.
207
207
  include(GNUInstallDirs)
208
208
 
209
- install(TARGETS yeptris_static
210
- EXPORT yeptris-targets
211
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
212
- )
209
+ if(TARGET yeptris_static)
210
+ install(TARGETS yeptris_static
211
+ EXPORT yeptris-targets
212
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
213
+ )
214
+ endif()
215
+ if(TARGET yeptris_shared)
216
+ install(TARGETS yeptris_shared
217
+ EXPORT yeptris-targets
218
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
219
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
220
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
221
+ )
222
+ endif()
213
223
  if(TARGET yeptris_jsonc)
214
224
  install(TARGETS yeptris_jsonc
215
225
  EXPORT yeptris-targets
@@ -65,24 +65,31 @@ YEPTRIS_API size_t yeptris_serialize_into_ex(YeptrisDocument handle,
65
65
  em.w.watermark = 0;
66
66
  em.w.sink_aborted = 0;
67
67
  em.w.flushed = 0;
68
- if (!yep_nametab_init(&em.canon_names, yep_system_allocator())) {
68
+ memset(&em.canon_names, 0, sizeof(em.canon_names));
69
+ if (em.w.canonical && !yep_nametab_init(&em.canon_names, yep_system_allocator())) {
69
70
  return 0;
70
71
  }
71
72
  em.w.sc_dec = (uint8_t*)malloc(em.doc->dom->ncount > 0 ? em.doc->dom->ncount : 1);
72
73
  if (em.w.sc_dec == NULL) {
73
- yep_nametab_free(&em.canon_names);
74
+ if (em.canon_names.sys != NULL) {
75
+ yep_nametab_free(&em.canon_names);
76
+ }
74
77
  return 0;
75
78
  }
76
79
  size_t need = yep_emit_run(&em, 1);
77
80
  if (buf == NULL || cap < need + 1) {
78
81
  free(em.w.sc_dec);
79
- yep_nametab_free(&em.canon_names);
82
+ if (em.canon_names.sys != NULL) {
83
+ yep_nametab_free(&em.canon_names);
84
+ }
80
85
  return need;
81
86
  }
82
87
  em.w.p = buf;
83
88
  size_t wrote = yep_emit_run(&em, 0);
84
89
  free(em.w.sc_dec);
85
- yep_nametab_free(&em.canon_names);
90
+ if (em.canon_names.sys != NULL) {
91
+ yep_nametab_free(&em.canon_names);
92
+ }
86
93
  buf[wrote] = '\0';
87
94
  return wrote;
88
95
  }
@@ -123,7 +130,8 @@ YEPTRIS_API char* yeptris_serialize_ex(YeptrisDocument handle, const yeptris_emi
123
130
  em.w.watermark = 0;
124
131
  em.w.sink_aborted = 0;
125
132
  em.w.flushed = 0;
126
- if (!yep_nametab_init(&em.canon_names, yep_system_allocator())) {
133
+ memset(&em.canon_names, 0, sizeof(em.canon_names));
134
+ if (em.w.canonical && !yep_nametab_init(&em.canon_names, yep_system_allocator())) {
127
135
  return NULL;
128
136
  }
129
137
  /* #352 slice 2: ONE wet pass into a growable buffer — the dry
@@ -138,7 +146,9 @@ YEPTRIS_API char* yeptris_serialize_ex(YeptrisDocument handle, const yeptris_emi
138
146
  }
139
147
  char* out = (char*)malloc(est);
140
148
  if (out == NULL) {
141
- yep_nametab_free(&em.canon_names);
149
+ if (em.canon_names.sys != NULL) {
150
+ yep_nametab_free(&em.canon_names);
151
+ }
142
152
  return NULL;
143
153
  }
144
154
  em.w.p = out;
@@ -152,16 +162,20 @@ YEPTRIS_API char* yeptris_serialize_ex(YeptrisDocument handle, const yeptris_emi
152
162
  out = em.w.p;
153
163
  if (em.w.oom) {
154
164
  free(out);
155
- yep_nametab_free(&em.canon_names);
165
+ if (em.canon_names.sys != NULL) {
166
+ yep_nametab_free(&em.canon_names);
167
+ }
156
168
  return NULL;
157
169
  }
158
- if (wrote + 1 < em.w.cap) {
170
+ if (em.w.cap - (wrote + 1) > em.w.cap / 8) {
159
171
  char* tight = (char*)realloc(out, wrote + 1);
160
172
  if (tight != NULL) {
161
173
  out = tight;
162
174
  }
163
175
  }
164
- yep_nametab_free(&em.canon_names);
176
+ if (em.canon_names.sys != NULL) {
177
+ yep_nametab_free(&em.canon_names);
178
+ }
165
179
  out[wrote] = '\0';
166
180
  if (len != NULL) {
167
181
  *len = wrote;
@@ -200,18 +214,23 @@ YEPTRIS_API char* yeptris_serialize_json(YeptrisDocument handle, size_t* len) {
200
214
  em.w.watermark = 0;
201
215
  em.w.sink_aborted = 0;
202
216
  em.w.flushed = 0;
203
- if (!yep_nametab_init(&em.canon_names, yep_system_allocator())) {
217
+ memset(&em.canon_names, 0, sizeof(em.canon_names));
218
+ if (em.w.canonical && !yep_nametab_init(&em.canon_names, yep_system_allocator())) {
204
219
  return NULL;
205
220
  }
206
221
  size_t need = yep_emit_run(&em, 1);
207
222
  char* out = malloc(need + 1);
208
223
  if (out == NULL) {
209
- yep_nametab_free(&em.canon_names);
224
+ if (em.canon_names.sys != NULL) {
225
+ yep_nametab_free(&em.canon_names);
226
+ }
210
227
  return NULL;
211
228
  }
212
229
  em.w.p = out;
213
230
  size_t wrote = yep_emit_run(&em, 0);
214
- yep_nametab_free(&em.canon_names);
231
+ if (em.canon_names.sys != NULL) {
232
+ yep_nametab_free(&em.canon_names);
233
+ }
215
234
  out[wrote] = '\0';
216
235
  if (len != NULL) {
217
236
  *len = wrote;
@@ -253,18 +272,23 @@ YEPTRIS_API char* yeptris_serialize_json_ex(YeptrisDocument handle, size_t* len,
253
272
  em.w.watermark = 0;
254
273
  em.w.sink_aborted = 0;
255
274
  em.w.flushed = 0;
256
- if (!yep_nametab_init(&em.canon_names, yep_system_allocator())) {
275
+ memset(&em.canon_names, 0, sizeof(em.canon_names));
276
+ if (em.w.canonical && !yep_nametab_init(&em.canon_names, yep_system_allocator())) {
257
277
  return NULL;
258
278
  }
259
279
  size_t need = yep_emit_run(&em, 1);
260
280
  char* out = malloc(need + 1);
261
281
  if (out == NULL) {
262
- yep_nametab_free(&em.canon_names);
282
+ if (em.canon_names.sys != NULL) {
283
+ yep_nametab_free(&em.canon_names);
284
+ }
263
285
  return NULL;
264
286
  }
265
287
  em.w.p = out;
266
288
  size_t wrote = yep_emit_run(&em, 0);
267
- yep_nametab_free(&em.canon_names);
289
+ if (em.canon_names.sys != NULL) {
290
+ yep_nametab_free(&em.canon_names);
291
+ }
268
292
  out[wrote] = '\0';
269
293
  if (len != NULL) {
270
294
  *len = wrote;
@@ -300,18 +324,23 @@ char* yep_serialize_json_compact(const yeptris_document* doc, size_t* len) {
300
324
  em.w.watermark = 0;
301
325
  em.w.sink_aborted = 0;
302
326
  em.w.flushed = 0;
303
- if (!yep_nametab_init(&em.canon_names, yep_system_allocator())) {
327
+ memset(&em.canon_names, 0, sizeof(em.canon_names));
328
+ if (em.w.canonical && !yep_nametab_init(&em.canon_names, yep_system_allocator())) {
304
329
  return NULL;
305
330
  }
306
331
  size_t need = yep_emit_run(&em, 1);
307
332
  char* out = malloc(need + 1);
308
333
  if (out == NULL) {
309
- yep_nametab_free(&em.canon_names);
334
+ if (em.canon_names.sys != NULL) {
335
+ yep_nametab_free(&em.canon_names);
336
+ }
310
337
  return NULL;
311
338
  }
312
339
  em.w.p = out;
313
340
  size_t wrote = yep_emit_run(&em, 0);
314
- yep_nametab_free(&em.canon_names);
341
+ if (em.canon_names.sys != NULL) {
342
+ yep_nametab_free(&em.canon_names);
343
+ }
315
344
  out[wrote] = '\0';
316
345
  if (len != NULL) {
317
346
  *len = wrote;
@@ -347,18 +376,23 @@ char* yep_serialize_json_pretty(const yeptris_document* doc, size_t* len) {
347
376
  em.w.watermark = 0;
348
377
  em.w.sink_aborted = 0;
349
378
  em.w.flushed = 0;
350
- if (!yep_nametab_init(&em.canon_names, yep_system_allocator())) {
379
+ memset(&em.canon_names, 0, sizeof(em.canon_names));
380
+ if (em.w.canonical && !yep_nametab_init(&em.canon_names, yep_system_allocator())) {
351
381
  return NULL;
352
382
  }
353
383
  size_t need = yep_emit_run(&em, 1);
354
384
  char* out = malloc(need + 1);
355
385
  if (out == NULL) {
356
- yep_nametab_free(&em.canon_names);
386
+ if (em.canon_names.sys != NULL) {
387
+ yep_nametab_free(&em.canon_names);
388
+ }
357
389
  return NULL;
358
390
  }
359
391
  em.w.p = out;
360
392
  size_t wrote = yep_emit_run(&em, 0);
361
- yep_nametab_free(&em.canon_names);
393
+ if (em.canon_names.sys != NULL) {
394
+ yep_nametab_free(&em.canon_names);
395
+ }
362
396
  out[wrote] = '\0';
363
397
  if (len != NULL) {
364
398
  *len = wrote;
@@ -409,13 +443,16 @@ YEPTRIS_API size_t yeptris_serialize_stream(YeptrisDocument handle,
409
443
  em.w.sink = sink;
410
444
  em.w.sink_ctx = ctx;
411
445
  em.w.watermark = YEP_EMIT_WATERMARK;
412
- if (!yep_nametab_init(&em.canon_names, yep_system_allocator())) {
446
+ memset(&em.canon_names, 0, sizeof(em.canon_names));
447
+ if (em.w.canonical && !yep_nametab_init(&em.canon_names, yep_system_allocator())) {
413
448
  return 0;
414
449
  }
415
450
  /* one scratch window; the writer flushes it when it fills */
416
451
  char* window = malloc(YEP_EMIT_WATERMARK * 2);
417
452
  if (window == NULL) {
418
- yep_nametab_free(&em.canon_names);
453
+ if (em.canon_names.sys != NULL) {
454
+ yep_nametab_free(&em.canon_names);
455
+ }
419
456
  return 0;
420
457
  }
421
458
  em.w.p = window;
@@ -429,6 +466,8 @@ YEPTRIS_API size_t yeptris_serialize_stream(YeptrisDocument handle,
429
466
  }
430
467
  }
431
468
  free(window);
432
- yep_nametab_free(&em.canon_names);
469
+ if (em.canon_names.sys != NULL) {
470
+ yep_nametab_free(&em.canon_names);
471
+ }
433
472
  return em.w.sink_aborted ? 0 : total;
434
473
  }
@@ -611,6 +611,67 @@ static void emit_block_map(yep_emitter* em, uint32_t id, int content_col) {
611
611
  uint32_t child = n->first_child;
612
612
  uint32_t pair = 0;
613
613
  while (child != UINT32_MAX) {
614
+ /* #352: the flat plain member specialist — tiny scalar pairs
615
+ * pay dispatch and props checks, not byte work. Strictly
616
+ * narrower than the general body below: plain unpropertied
617
+ * key, plain unpropertied scalar value, both safety-proven by
618
+ * the exact predicates sc_route consults (no memo touch, so
619
+ * the dry/wet sc_i streams stay aligned). Anything else falls
620
+ * through untouched — parity by construction. */
621
+ const yep_dnode* kn0 = yep_dom_node(d, child);
622
+ const yep_dnode* vn0 = yep_dom_node(d, kn0->next_sibling);
623
+ if (!w->canonical && !w->json && !w->force_flow && vn0 != NULL && kn0->kind == 0 &&
624
+ kn0->style == 1 && kn0->anchor.len == 0 && kn0->tag.len == 0 && kn0->count == 0 &&
625
+ vn0->kind == 0 && vn0->style == 1 && vn0->anchor.len == 0 && vn0->tag.len == 0 &&
626
+ vn0->count == 0) {
627
+ yep_view kv = wv(w, kn0->value);
628
+ yep_view vv = wv(w, vn0->value);
629
+ if (kv.len > 0 && yep_style_plain_key_safe((const char*)kv.p, kv.len) &&
630
+ (vv.len == 0 || yep_style_plain_safe((const char*)vv.p, vv.len))) {
631
+ /* fused member write: plain-safe spans carry no breaks,
632
+ * so the col scan is arithmetic and one reservation
633
+ * covers the whole member (line + key + ':' + value) */
634
+ uint32_t ind = pair > 0 ? (uint32_t)content_col : 0u;
635
+ uint32_t nl = (pair > 0 && w->last != '\n') ? 1u : 0u;
636
+ uint32_t total = nl + ind + kv.len + 1u + (vv.len > 0 ? vv.len + 1u : 0u);
637
+ w->last = vv.len > 0 ? (char)vv.p[vv.len - 1] : ':';
638
+ if (nl) {
639
+ w->col = (int)(total - 1u); /* the break resets, then the line */
640
+ } else {
641
+ w->col += (int)total;
642
+ }
643
+ if (w->dry) {
644
+ w->len += total;
645
+ } else {
646
+ if (w->grow && w->len + total + 1 > w->cap) {
647
+ wr_grow(w, total);
648
+ }
649
+ if (w->oom) {
650
+ w->len += total; /* keep counting: the caller fails on oom */
651
+ } else {
652
+ char* q = w->p + w->len;
653
+ if (nl) {
654
+ *q++ = '\n';
655
+ }
656
+ for (uint32_t i = 0; i < ind; i++) {
657
+ *q++ = ' ';
658
+ }
659
+ memcpy(q, kv.p, kv.len);
660
+ q += kv.len;
661
+ *q++ = ':';
662
+ if (vv.len > 0) {
663
+ *q++ = ' ';
664
+ memcpy(q, vv.p, vv.len);
665
+ }
666
+ w->len += total;
667
+ wr_maybe_flush(w);
668
+ }
669
+ }
670
+ pair++;
671
+ child = vn0->next_sibling;
672
+ continue;
673
+ }
674
+ }
614
675
  const yep_dnode* kn = yep_dom_node(d, child);
615
676
  const yep_dnode* vn = yep_dom_node(d, kn->next_sibling);
616
677
  if (pair > 0) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.29.1
4
+ version: 0.6.30.1
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-05 00:00:00.000000000 Z
11
+ date: 2026-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi