teptris 0.3.11.1-s390x-linux → 0.3.12.1-s390x-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: 4254595828c6e9baba90ba2c0a57c2e78ea841ba97ff48604e9f61f548cf1fc6
4
- data.tar.gz: 5a387fdb91891dcb0e9c8458c58f198921be2fdb30df4dc468cd810170f68fae
3
+ metadata.gz: 173d8f6ff382784dc094a76f0106395d0f27e8c0879679f26f70c4bb41482285
4
+ data.tar.gz: 856538b1fb98fdd07f37288e468ea88d34ce670073e4d10581b90c24a4895059
5
5
  SHA512:
6
- metadata.gz: f53996270df6f8ac3e14eaaf7a872333a21503572d246af720d5c8977ae89f456a4377b978ef8d78d452f04800afc9901fa5ed9a4cac6351635e37ec792bd2bf
7
- data.tar.gz: 1977fe3e69dbb5399596a4a84b98facb46e92025f134ba26525daf29489948da2c9106d5edc4b891fe2e0ef59e4c3e235673f6e984eb163ef45da78a554556e2
6
+ metadata.gz: 79241aa7ae4a05447e4669c44ad28e43affd03285b3c93ee6b06412fa5ccf3d0f3e315bd5e329e44ac59e448efb9d61191c4089367b49438dbd820f8abc06238
7
+ data.tar.gz: 253a29b49f45d670ec058ddd78b5811bbd0402794ef0aceb59f0d4ab5c9bc4eeab9fc2ab2f2102f86d6235fd850823cc773c750deab6ee1c9c3fa06393061fa0
@@ -1,4 +1,4 @@
1
- # libteptris 0.3.11 — vendored source
1
+ # libteptris 0.3.12 — vendored source
2
2
 
3
3
  This directory carries the COMPLETE C source of the engine this
4
4
  gem's extension was built from (the packaging doctrine: compiled
@@ -4,6 +4,6 @@
4
4
  #define TEPTRIS_VERSION_MAJOR 0
5
5
  #define TEPTRIS_VERSION_MINOR 3
6
6
  #define TEPTRIS_VERSION_PATCH 0
7
- #define TEPTRIS_VERSION_STRING "0.3.11"
7
+ #define TEPTRIS_VERSION_STRING "0.3.12"
8
8
 
9
9
  #endif /* TEPTRIS_VERSION_H */
@@ -104,6 +104,15 @@ teptris_status teptris_parse_key_path(teptris_parser *ps,
104
104
  }
105
105
  v[n++] = key;
106
106
 
107
+ /* each dotted component is one table level in the DOM - cap it
108
+ * against the same ceiling as '['/'{' nesting, or a hostile
109
+ * a.b.b.b...=1 line builds an uncapped-depth tree that blows
110
+ * the recursive emit/free passes */
111
+ if (n > ps->max_depth) {
112
+ return tep_fail_at(ps, NULL, TEPTRIS_ERR_DEPTH,
113
+ "key path too deep");
114
+ }
115
+
107
116
  st = tep_skip_ws(ps);
108
117
  if (st != TEPTRIS_OK) {
109
118
  return st;
@@ -201,7 +201,8 @@ teptris_status tep_scan_basic(teptris_parser *ps, bool ml, char *out,
201
201
  }
202
202
  if (c == '\r') {
203
203
  if (ml && ps->p + 1 < ps->end && ps->p[1] == '\n') {
204
- PUTCH(out, n, '\r');
204
+ PUTCH(out, n, '\n'); /* CRLF normalizes to LF inside multi-line
205
+ strings (tomllib reference) */
205
206
  tep_adv(ps, 2);
206
207
  continue;
207
208
  }
@@ -267,7 +268,8 @@ teptris_status tep_scan_literal(teptris_parser *ps, bool ml, char *out,
267
268
  }
268
269
  if (c == '\r') {
269
270
  if (ml && ps->p + 1 < ps->end && ps->p[1] == '\n') {
270
- PUTCH(out, n, '\r');
271
+ PUTCH(out, n, '\n'); /* CRLF normalizes to LF inside multi-line
272
+ strings (tomllib reference) */
271
273
  tep_adv(ps, 2);
272
274
  continue;
273
275
  }
@@ -1132,10 +1132,13 @@ static VALUE ext_load_lazy_batch(VALUE self, VALUE strings) {
1132
1132
  }
1133
1133
  if (first_fail != -1) {
1134
1134
  const teptris_error *e = teptris_document_error(s->docs[first_fail]);
1135
- VALUE ex =
1136
- rb_exc_new(eParseError, e->message, (long)strlen(e->message));
1135
+ char msg[192];
1136
+ snprintf(msg, sizeof msg, "document %ld: %s", first_fail,
1137
+ e->message);
1138
+ VALUE ex = rb_exc_new(eParseError, msg, (long)strlen(msg));
1137
1139
  rb_iv_set(ex, "@line", SIZET2NUM(e->line));
1138
1140
  rb_iv_set(ex, "@column", SIZET2NUM(e->column));
1141
+ rb_iv_set(ex, "@index", LONG2NUM(first_fail));
1139
1142
  for (long i = 0; i < n; i++) teptris_document_free(s->docs[i]);
1140
1143
  batch_scratch_free(s);
1141
1144
  rb_exc_raise(ex);
@@ -1224,10 +1227,12 @@ static VALUE ext_load_slice(int argc, VALUE *argv, VALUE self) {
1224
1227
  }
1225
1228
  const teptris_error *e = teptris_document_error(docs[i]);
1226
1229
  if (stats[i] != TEPTRIS_OK) {
1227
- VALUE ex = rb_exc_new(eParseError, e->message,
1228
- (long)strlen(e->message));
1230
+ char msg[192];
1231
+ snprintf(msg, sizeof msg, "document %ld: %s", i, e->message);
1232
+ VALUE ex = rb_exc_new(eParseError, msg, (long)strlen(msg));
1229
1233
  rb_iv_set(ex, "@line", SIZET2NUM(e->line));
1230
1234
  rb_iv_set(ex, "@column", SIZET2NUM(e->column));
1235
+ rb_iv_set(ex, "@index", LONG2NUM(i));
1231
1236
  long j;
1232
1237
  for (j = i; j < n; j++) teptris_document_free(docs[j]);
1233
1238
  kc_free(&kc);
@@ -1281,10 +1286,13 @@ static VALUE ext_load_batch(int argc, VALUE *argv, VALUE self) {
1281
1286
  }
1282
1287
  if (first_fail != -1) {
1283
1288
  const teptris_error *e = teptris_document_error(s->docs[first_fail]);
1284
- VALUE ex =
1285
- rb_exc_new(eParseError, e->message, (long)strlen(e->message));
1289
+ char msg[192];
1290
+ snprintf(msg, sizeof msg, "document %ld: %s", first_fail,
1291
+ e->message);
1292
+ VALUE ex = rb_exc_new(eParseError, msg, (long)strlen(msg));
1286
1293
  rb_iv_set(ex, "@line", SIZET2NUM(e->line));
1287
1294
  rb_iv_set(ex, "@column", SIZET2NUM(e->column));
1295
+ rb_iv_set(ex, "@index", LONG2NUM(first_fail));
1288
1296
  for (long i = 0; i < n; i++) teptris_document_free(s->docs[i]);
1289
1297
  batch_scratch_free(s);
1290
1298
  rb_exc_raise(ex);
Binary file
Binary file
Binary file
data/lib/teptris/error.rb CHANGED
@@ -5,6 +5,9 @@ module Teptris
5
5
 
6
6
  class ParseError < Error
7
7
  attr_reader :line, :column
8
+ # batch context: load_batch/load_slice set this to the 0-based
9
+ # position of the failing document in the batch
10
+ attr_accessor :index
8
11
 
9
12
  def initialize(message, line = 0, column = 0)
10
13
  @line = line
data/lib/teptris/toml.rb CHANGED
@@ -121,13 +121,26 @@ module Teptris::TOML
121
121
  end
122
122
  end
123
123
  end.each(&:join)
124
- if first_error
125
- _, err = first_error
126
- raise err
127
- end
124
+ raise_batch_error!(first_error) if first_error
128
125
  results
129
126
  end
130
127
 
128
+ # the slice's error is slice-local (its message and @index count
129
+ # from the slice's first document); translate both to batch-global
130
+ def raise_batch_error!(first_error)
131
+ return unless first_error
132
+
133
+ base, err = first_error
134
+ return unless err
135
+
136
+ global = (base || 0) + (err.index || 0)
137
+ text = err.message.sub(/\Adocument \d+: /, "")
138
+ wrapped = Teptris::ParseError.new("document #{global}: #{text}",
139
+ err.line, err.column)
140
+ wrapped.index = global
141
+ raise wrapped
142
+ end
143
+
131
144
  # Lazy twin of load_batch: parse N inputs eagerly, hand back an
132
145
  # Array of Lazy wrappers — materialization happens only on access.
133
146
  # Same per-doc error semantics as load_lazy (first failure raises).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Teptris
4
- VERSION = "0.3.11.1"
4
+ VERSION = "0.3.12.1"
5
5
  end
data/sig/teptris.rbs CHANGED
@@ -10,6 +10,9 @@ module Teptris
10
10
  class ParseError < Error
11
11
  attr_reader line: Integer
12
12
  attr_reader column: Integer
13
+ # batch context: set by load_batch/load_slice on batch failures -
14
+ # the 0-based position of the failing document in the batch
15
+ attr_accessor index: Integer?
13
16
 
14
17
  def initialize: (String message, ?Integer line, ?Integer column) -> void
15
18
  end
@@ -39,6 +42,8 @@ module Teptris
39
42
  ?threads: Integer)
40
43
  -> Array[Hash[String, untyped]]
41
44
 
45
+ def self.raise_batch_error!: ([Integer, ParseError]?) -> void
46
+
42
47
  def self.load_lazy_batch: (Array[String] tomls)
43
48
  -> Array[TeptrisExt::LazyValue]
44
49
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11.1
4
+ version: 0.3.12.1
5
5
  platform: s390x-linux
6
6
  authors:
7
7
  - teptris contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-30 00:00:00.000000000 Z
11
+ date: 2026-10-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A native C extension over libteptris, a C99 TOML 1.1 parser/emitter.
14
14
  API shape mirrors the tomlib gem.