parsanol 1.3.99-aarch64-linux → 1.3.100-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/atoms/base.rb +7 -1
- data/lib/parsanol/error_reporter/deepest.rb +4 -0
- data/lib/parsanol/native.rb +4 -2
- 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: ffe9cf736fae27a11f941c38eaa1ec8f5ad6a67af74a81952d6a2a39478cd69d
|
|
4
|
+
data.tar.gz: 5a35dd607a8ca943fb12da09ce8f90a6e9c15efaddb589e3861ab6b71ed646f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4426f5e8c9a6073f95582e6ffbaec7d3efdd4b2cea1525db7cadc6baf1b64b4394ff1da62758b72b171c86a4d9134c09b0b104f408f35ec871b7eeaead0853d6
|
|
7
|
+
data.tar.gz: 8196495a9b452106dd4f1ef500b16e5dedadb06984b605629ae473051af4a4fb18a79fbe53b04f8c325f6c6f9142b904d6ee34b51d5e10e2c0bb1546d2841d11
|
data/lib/parsanol/atoms/base.rb
CHANGED
|
@@ -236,9 +236,15 @@ module Parsanol
|
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
# Reports detailed error by reparsing with reporter.
|
|
239
|
+
#
|
|
240
|
+
# The default reporter is Deepest (parsanol-ruby#265): the native
|
|
241
|
+
# engine's failure diagnostics report the furthest failure, and a
|
|
242
|
+
# consumer's file:line:col degrades to "line 1 char 1" when the
|
|
243
|
+
# interpreter raises the outermost sequence instead. Explicit
|
|
244
|
+
# reporters (Tree for full cause trees) are honored unchanged.
|
|
239
245
|
def report_detailed_error(input, consume_all, reporter, _initial_error)
|
|
240
246
|
input.bytepos = 0
|
|
241
|
-
error_reporter = reporter || Parsanol::ErrorReporter::
|
|
247
|
+
error_reporter = reporter || Parsanol::ErrorReporter::Deepest.new
|
|
242
248
|
success, cause = run_with_context(input, error_reporter, consume_all)
|
|
243
249
|
|
|
244
250
|
# Second parse should also fail
|
|
@@ -98,12 +98,16 @@ module Parsanol
|
|
|
98
98
|
# @return [Array<Integer, Parsanol::Cause>] [depth, deepest_leaf]
|
|
99
99
|
#
|
|
100
100
|
def find_deepest_leaf(node, rank = 0)
|
|
101
|
+
return [rank, node] if node.nil?
|
|
102
|
+
|
|
101
103
|
best_node = node
|
|
102
104
|
best_rank = rank
|
|
103
105
|
|
|
104
106
|
kids = node.children
|
|
105
107
|
if kids && !kids.empty?
|
|
106
108
|
kids.each do |kid|
|
|
109
|
+
next if kid.nil?
|
|
110
|
+
|
|
107
111
|
kid_rank, kid_node = find_deepest_leaf(kid, rank + 1)
|
|
108
112
|
|
|
109
113
|
if kid_rank > best_rank
|
data/lib/parsanol/native.rb
CHANGED
|
@@ -282,8 +282,10 @@ module Parsanol
|
|
|
282
282
|
if parsanol_grammar
|
|
283
283
|
# No native diagnostics (e.g. incomplete-input errors): one
|
|
284
284
|
# interpreter pass with the reporter attached — a success
|
|
285
|
-
# recovers the tree, a failure raises the cause tree.
|
|
286
|
-
|
|
285
|
+
# recovers the tree, a failure raises the cause tree. Deepest
|
|
286
|
+
# keeps the fallback's diagnostics at parity with the direct
|
|
287
|
+
# interpreter path (parsanol-ruby#265).
|
|
288
|
+
reporter = Parsanol::ErrorReporter::Deepest.new
|
|
287
289
|
source = Parsanol::Source.new(input)
|
|
288
290
|
success, value = grammar.run_with_context(source, reporter, true)
|
|
289
291
|
return grammar.finalize_result(value) if success
|
data/lib/parsanol/version.rb
CHANGED