yeptris 0.6.34.3 → 0.6.35.2

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.
@@ -268,14 +268,33 @@ static uint32_t finish_double_body(const char* p, uint32_t start, uint32_t end,
268
268
  }
269
269
  case '\n':
270
270
  case '\r': {
271
- /* line continuation: swallow the break and next line's leading spaces */
271
+ /* Escaped line break: the break itself is removed, but every
272
+ * break after it (whitespace-only lines included) contributes
273
+ * one newline, and the next line's leading whitespace is
274
+ * stripped. Folding the remaining run with the plain N-1 rule
275
+ * loses one break (libyaml and libfyaml agree on this count). */
272
276
  size_t j = i;
273
277
  if (p[j] == '\r' && j + 1 < end && p[j + 1] == '\n') {
274
278
  j++;
275
279
  }
276
280
  j++;
277
- while (j < end && (p[j] == ' ' || p[j] == '\t')) {
278
- j++;
281
+ uint32_t extra = 0;
282
+ for (;;) {
283
+ while (j < end && (p[j] == ' ' || p[j] == '\t')) {
284
+ j++;
285
+ }
286
+ if (j < end && (p[j] == '\n' || p[j] == '\r')) {
287
+ if (p[j] == '\r' && j + 1 < end && p[j + 1] == '\n') {
288
+ j++;
289
+ }
290
+ j++;
291
+ extra++;
292
+ continue;
293
+ }
294
+ break;
295
+ }
296
+ for (uint32_t k = 0; k < extra; k++) {
297
+ yep_buf_putc(b, '\n');
279
298
  }
280
299
  i = j;
281
300
  break;
@@ -290,9 +290,15 @@ static yep_tag_id compat11(void* ctx, const char* p, uint32_t n) {
290
290
  return 1; /* plain 0 */
291
291
  }
292
292
  }
293
- /* decimal int / float with underscores and commas (psych legacy) */
293
+ /* decimal int / float with underscores and commas (psych legacy).
294
+ * The float law is psych's scanner (and libyaml's 1.1 resolver): a
295
+ * DOT is required, and an exponent only counts when SIGNED —
296
+ * "1e0" and "1.5e2" stay strings (psych tokenize; libyaml's 1.1
297
+ * float regex agrees), "1.5" / ".5" / "1.5e+2" are floats. The
298
+ * unqualified-exponent float leaked host strings into number
299
+ * typing (yeptris-ruby #293's CBOR dump). */
294
300
  {
295
- int digits = 0, dot = 0, e = 0, ed = 0;
301
+ int digits = 0, dot = 0, e = 0, ed = 0, esigned = 0;
296
302
  for (uint32_t k = i; k < n; k++) {
297
303
  char c = p[k];
298
304
  if (c >= '0' && c <= '9') {
@@ -311,13 +317,14 @@ static yep_tag_id compat11(void* ctx, const char* p, uint32_t n) {
311
317
  } else if ((c == 'e' || c == 'E') && digits && !e) {
312
318
  e = 1;
313
319
  if (k + 1 < n && (p[k + 1] == '-' || p[k + 1] == '+')) {
320
+ esigned = 1;
314
321
  k++;
315
322
  }
316
323
  } else {
317
324
  return 0;
318
325
  }
319
326
  }
320
- if (digits && (dot || e) && (!e || ed)) {
327
+ if (digits && dot && (!e || (ed && esigned))) {
321
328
  return 2;
322
329
  }
323
330
  if (digits && !dot && !e) {
@@ -214,6 +214,7 @@ static int shape_val_bail(unsigned char c, const char* p, size_t len, size_t at)
214
214
  case '[':
215
215
  case '{':
216
216
  case '*': /* an alias after an anchor is an error shape (SR86) */
217
+ case '&': /* a second anchor is the suite's 4JVG error (catch 156) */
217
218
  return 1;
218
219
  case '-':
219
220
  case '?':
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.34.3
4
+ version: 0.6.35.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.