parsanol 1.3.104-aarch64-linux → 1.3.105-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 +4 -4
- data/lib/parsanol/parg/artifact.rb +41 -6
- data/lib/parsanol/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82bc03a0b23a9a8d7504a043a69dd3b4173924c644cd94a3261311d3a4723218
|
|
4
|
+
data.tar.gz: ff3498232d47c056f13cd1eecbc048cb2281b83b4ecda6bc775d19317906769d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1de990af98a1415ae63ceaa6273172966022666518470b6d0759fb385df86db5aaa63bd5ef5e36463ba1329f08428bd36c11ee34638b5ed013851d0a82e6cc75
|
|
7
|
+
data.tar.gz: 22e439c393b64036d5b9151e7016edeae132948fca1812fb337a39d053fbf69eaacfed77603a8e96b29d03e36a3087408fd3e7c86cab41e42deddcfcf802609a
|
|
@@ -331,14 +331,33 @@ module Parsanol
|
|
|
331
331
|
{ root_name => flattened }
|
|
332
332
|
end
|
|
333
333
|
|
|
334
|
+
# Recovery error wire — the rs engine's F7 shape (offset, line,
|
|
335
|
+
# column, expected at the deepest position, ranked distinct
|
|
336
|
+
# positions deepest-first), computed from the interpreter's cause
|
|
337
|
+
# tree. `message` rides along for consumers that surface the
|
|
338
|
+
# rendered text (lutaml-lml digs line/column from it).
|
|
339
|
+
# Parity with parsanol::portable::parser::MAX_RANKED_FAILURES.
|
|
340
|
+
MAX_RANKED_FAILURES = 8
|
|
341
|
+
|
|
334
342
|
def recovery_error(err)
|
|
335
343
|
cause = err.parse_failure_cause
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
344
|
+
return { "offset" => nil, "message" => err.message } unless cause
|
|
345
|
+
|
|
346
|
+
ranks = collect_ranks(cause)
|
|
347
|
+
offset = ranks.keys.max
|
|
348
|
+
line, column = cause.source&.line_and_column(offset)
|
|
349
|
+
{
|
|
350
|
+
"offset" => offset,
|
|
351
|
+
"line" => line,
|
|
352
|
+
"column" => column,
|
|
353
|
+
# The deepest entry mirrors ranked's head — same as the rs
|
|
354
|
+
# wire, where failure_wire and ranked[0] agree.
|
|
355
|
+
"expected" => ranks[offset] || [],
|
|
356
|
+
"ranked" => ranks.sort_by { |pos, _| -pos }
|
|
357
|
+
.first(MAX_RANKED_FAILURES)
|
|
358
|
+
.map { |pos, labels| [pos, labels] },
|
|
359
|
+
"message" => err.message,
|
|
360
|
+
}
|
|
342
361
|
end
|
|
343
362
|
|
|
344
363
|
def deepest_position(cause)
|
|
@@ -351,6 +370,22 @@ module Parsanol
|
|
|
351
370
|
max
|
|
352
371
|
end
|
|
353
372
|
|
|
373
|
+
# Distinct failure positions with the labels expected at each —
|
|
374
|
+
# every cause node contributes its position and message; deeper
|
|
375
|
+
# duplicates of the same position merge. Capped like the rs wire
|
|
376
|
+
# (MAX_RANKED_FAILURES) at the reader, deepest first.
|
|
377
|
+
def collect_ranks(cause, into = {})
|
|
378
|
+
labels = into[cause.position] ||= []
|
|
379
|
+
text = cause.message.to_s
|
|
380
|
+
labels << text unless labels.include?(text)
|
|
381
|
+
Array(cause.children).each do |child|
|
|
382
|
+
next if child.nil?
|
|
383
|
+
|
|
384
|
+
collect_ranks(child, into)
|
|
385
|
+
end
|
|
386
|
+
into
|
|
387
|
+
end
|
|
388
|
+
|
|
354
389
|
# Journaling re-parse — always on the Ruby engine (journaling
|
|
355
390
|
# rides the interpreter's diagnostic reparse; the native engine
|
|
356
391
|
# has no journal). Tree parity with the native engine is enforced
|
data/lib/parsanol/version.rb
CHANGED