yeptris 0.6.23.1-arm-linux-eabihf → 0.6.24.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 627e70bedb0bd290674f8a94d08ad53c68e48cf60b5752783b6d8db3391921d3
4
- data.tar.gz: 79403cdb0ce605fd4d79777291e02274afb041200f9f5b7d8972538442a29a31
3
+ metadata.gz: be7b901a161d066e748826fe3ac972c9983a52b55582fa7c89eb4331c05f49ef
4
+ data.tar.gz: 3ccd1a2643b5318cfcfbbeb61181d1a8cbe44ac8d8a27e7263e8cc058fb6490f
5
5
  SHA512:
6
- metadata.gz: 1512bd1736078082f3de2a1c07afc42c998ba53a5204fb2073a8c3f49510231c42deb96322cf92ac16764df6c24eeaa7b02fad5cfc0113bdefbd97beb039355a
7
- data.tar.gz: 44c9e72d06b689ce1e18e4b2283421f99d20ee9b89a076a1e0439d91d0b0254cae04a819334c6b63a3ba49d686efe57eef39871dce52f36a36cfb5301c67fbf1
6
+ metadata.gz: 8db0c59bdaf18260418098039c3e0d4d2475eb0fffb912dc7f799eb2dbe56541751bb7c74c5148bb92d263074475aeea48bfae636313fe502a255e083cf247f9
7
+ data.tar.gz: f6a6f98cdc40ae6a040769839e6ff24458c5053a02cdae66a4e5c728755b41b4724bec6ca5f5f076b9ff395eb91acf7de220a902c4bd3ca8a9fd22d2d320691b
@@ -17,6 +17,16 @@ class Yeptris::Document
17
17
  attr_reader :parse_schema
18
18
 
19
19
  def initialize(c_ptr = nil, freed = Freed.new(:alive), parse_schema = :core_12)
20
+ # The pointer is produced by the FFI parse/create calls; a nil (or
21
+ # non-pointer) argument is an API misuse — Document.parse and
22
+ # Document.create are the entry points. Fail with that guidance
23
+ # instead of a NoMethodError from the finalizer guard below (the
24
+ # FFI::Pointer#null? probe does not exist on nil).
25
+ unless c_ptr.is_a?(::FFI::Pointer)
26
+ raise ArgumentError,
27
+ "a document FFI pointer is required — build documents with " \
28
+ "Yeptris::Document.parse or Yeptris::Document.create"
29
+ end
20
30
  @c_ptr = c_ptr
21
31
  @freed = freed
22
32
  @parse_schema = parse_schema
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.23.1".freeze
6
+ VERSION = "0.6.24.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.23
6
+ VERSION 0.6.24
7
7
  DESCRIPTION "Ultra-fast YAML 1.2 parser, emitter and streamer in C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -389,6 +389,11 @@ int yep_values_from_input(const char* yaml, size_t len, int schema_compat, yep_v
389
389
  return -1;
390
390
  }
391
391
  yep_engine_set_resolver(eng, schema_compat ? yep_resolver_compat11() : yep_resolver_core12());
392
+ if (schema_compat) {
393
+ yep_engine_set_compat_grammar(eng, 1); /* libyaml grammar parity
394
+ * (the value drains ride the
395
+ * same compat contract) */
396
+ }
392
397
 
393
398
  yep_value_ctx* c = ctx_create();
394
399
  if (c == NULL) {
@@ -124,6 +124,13 @@ struct yep_engine {
124
124
  int doc_inline; /* content node opened on the --- line */
125
125
  uint16_t flow_floor; /* parent column of the current block-level flow */
126
126
  int flow_enforce; /* flow continuation lines must out-indent it */
127
+ int compat_grammar; /* 11-COMPAT: libyaml/psych grammar parity —
128
+ * the flow indent floor (9C9N/VJP3) is a
129
+ * yaml-test-suite rule libyaml never
130
+ * enforced, and real-world locale files
131
+ * close multi-line flows at the parent's
132
+ * column; the floor stays on for the
133
+ * strict 1.2 engine the suite runs */
127
134
  };
128
135
 
129
136
  /* ------------------------------------------------------------ forwards */
@@ -2308,7 +2315,7 @@ static int e_shape_flow_value(yep_engine* e, const yep_line_shape* sh, uint16_t
2308
2315
  yep_view none = {NULL, 0};
2309
2316
  e->pos = sh->val_start;
2310
2317
  e->flow_floor = floor;
2311
- e->flow_enforce = (e->depth > 0);
2318
+ e->flow_enforce = (e->depth > 0) && !e->compat_grammar;
2312
2319
  int fast = e_flow_json(e, none, none, 0);
2313
2320
  e->flow_enforce = 0;
2314
2321
  if (fast == -2) {
@@ -2735,7 +2742,7 @@ static int e_node(yep_engine* e, yep_ctx ctx, uint16_t floor_col) {
2735
2742
  /* JSON fast path first: its validating scan already finds the
2736
2743
  * close, replacing e_skip_flow's pre-scan when it applies. */
2737
2744
  e->flow_floor = floor_col;
2738
- e->flow_enforce = (e->depth > 0);
2745
+ e->flow_enforce = (e->depth > 0) && !e->compat_grammar;
2739
2746
  int fast = e_flow_json(e, node_a, node_t, anchor_ordinal);
2740
2747
  e->flow_enforce = 0;
2741
2748
  if (fast == 1) {
@@ -2780,7 +2787,7 @@ static int e_node(yep_engine* e, yep_ctx ctx, uint16_t floor_col) {
2780
2787
  }
2781
2788
  {
2782
2789
  e->flow_floor = floor_col;
2783
- e->flow_enforce = (e->depth > 0);
2790
+ e->flow_enforce = (e->depth > 0) && !e->compat_grammar;
2784
2791
  int rc = e_flow(e, node_a, node_t, node_aid);
2785
2792
  e->flow_enforce = 0;
2786
2793
  if (rc != 0) {
@@ -3112,6 +3119,12 @@ void yep_engine_set_resolver(yep_engine* e, const yep_resolver* r) {
3112
3119
  }
3113
3120
  }
3114
3121
 
3122
+ void yep_engine_set_compat_grammar(yep_engine* e, int on) {
3123
+ if (e != NULL) {
3124
+ e->compat_grammar = on != 0;
3125
+ }
3126
+ }
3127
+
3115
3128
  void yep_engine_set_max_depth(yep_engine* e, int depth) {
3116
3129
  if (e != NULL && depth > 0) {
3117
3130
  e->max_depth = depth > YEP_MAX_DEPTH ? YEP_MAX_DEPTH : depth;
@@ -52,6 +52,13 @@ struct yep_resolver;
52
52
  void yep_engine_set_resolver(yep_engine* e, const struct yep_resolver* r);
53
53
  void yep_engine_set_max_depth(yep_engine* e, int depth);
54
54
 
55
+ /* The 1.1-compat grammar (libyaml/psych parity): the block-level flow
56
+ * indent floor (9C9N, VJP3) is a yaml-test-suite rule libyaml never
57
+ * enforced — real-world locale files close multi-line flow collections
58
+ * at their parent's column ("k: {\n a: b\n}"). Off by default (the
59
+ * strict 1.2 engine the conformance suite runs keeps the floor). */
60
+ void yep_engine_set_compat_grammar(yep_engine* e, int on);
61
+
55
62
  /* Byte offset the last run reached (into that run's buffer); used by
56
63
  * consumers that stop the engine at a boundary and resume. */
57
64
  size_t yep_engine_pos(const yep_engine* e);
@@ -301,6 +301,12 @@ engine_enter:
301
301
  yep_engine_set_resolver(eng, opts->schema == YEPTRIS_SCHEMA_11_COMPAT
302
302
  ? yep_resolver_compat11()
303
303
  : yep_resolver_core12());
304
+ if (opts->schema == YEPTRIS_SCHEMA_11_COMPAT) {
305
+ /* the compat schema is the psych/libyaml surface: its grammar
306
+ * must accept what libyaml accepts (the flow floor is suite-
307
+ * strict, not libyaml — see yep_engine_set_compat_grammar) */
308
+ yep_engine_set_compat_grammar(eng, 1);
309
+ }
304
310
  if (opts->max_depth > 0) {
305
311
  yep_engine_set_max_depth(eng, opts->max_depth);
306
312
  }
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.23.1
4
+ version: 0.6.24.1
5
5
  platform: arm-linux-eabihf
6
6
  authors:
7
7
  - Ribose Inc.