parsanol 1.3.21-aarch64-linux → 1.3.23-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: befd7dcaa05a6edd269baad0aa92c41fb63cfbe1e28e0a59fa2a7d969dd05bab
4
- data.tar.gz: b0fa1be1eeb3f432c4116a7a0bbb6fbd1fd3abd8234f184deb4145f4251dce95
3
+ metadata.gz: fc75979b185527911cf91f017c326e76b6d046e4e8eae07d5d4a65a1d2c0d287
4
+ data.tar.gz: ae34ac786d6537ca5fbd9ac621454a4ddb5b2c2078a24795938c532561696e16
5
5
  SHA512:
6
- metadata.gz: 300e98e15972f8541b692b3b55892d23be8f148648714ca04c3de9fa84c50322dd54ff3c8974a2dc14bf67e7a77ce3e241d39d54f4f6d64d6b8632e1ae3dae94
7
- data.tar.gz: d7737c9a6335530a6b73b2e64250dd2f5aebb47fd54a4eea9969e2468118ab932cfa57ec56a4877bcfe6097143b712f0be73327e39bb0b8f02ff5dd01bdac3f5
6
+ metadata.gz: 7e19eb7305940707e73b01ba063e23e2aa8bdf488162a44d793915d63d2503846d036407ae0a8d367e8e5f60d5b4d8ddac133516ef6bffa80c1e56b6fcd34abc
7
+ data.tar.gz: f53f311529672a40c34eafd4af9419293e4ba954f366055f8e82b7c55829077ee5b52c7f968ea7a2409b7869bff3305b6be622ac5c12281dbbf6caddc1b1ab0b
Binary file
Binary file
Binary file
Binary file
@@ -202,14 +202,29 @@ module Parsanol
202
202
  # native serializer cannot express (e.g. custom atoms). For
203
203
  # pre-serialized JSON grammars the native message is wrapped in a
204
204
  # Parsanol::ParseFailed directly.
205
+ NATIVE_POS_MARKER = /\n@@parsanol_pos:(\d+)\z/
206
+
205
207
  def raise_native_parse_error(error, grammar, input)
208
+ # Native diagnostics: the Rust tracker reports the deepest
209
+ # failure position and the terminals expected there. Build the
210
+ # cause from that directly — the failure path never needs a
211
+ # reporter reparse. The single interpreter pass below stays only
212
+ # to recover inputs from grammars native cannot express.
213
+ if grammar.respond_to?(:parse) && (m = error.message.match(NATIVE_POS_MARKER))
214
+ source = Parsanol::Source.new(input)
215
+ success, value = grammar.run_with_context(source, nil, true)
216
+ return grammar.finalize_result(value) if success
217
+
218
+ pos = m[1].to_i
219
+ msg = error.message.sub(NATIVE_POS_MARKER, "")
220
+ cause = Parsanol::Cause.new(msg, source, pos)
221
+ raise Parsanol::ParseFailed.new(cause.to_s, cause)
222
+ end
223
+
206
224
  if grammar.respond_to?(:parse)
207
- # One interpreter pass with the error reporter attached covers
208
- # both jobs: a success means the native backend could not
209
- # express the grammar (recover the tree), a failure raises the
210
- # parslet-compatible cause tree. The native backend has
211
- # already failed, so a separate plain attempt first would be a
212
- # wasted parse.
225
+ # No native diagnostics (e.g. incomplete-input errors): one
226
+ # interpreter pass with the reporter attached — a success
227
+ # recovers the tree, a failure raises the cause tree.
213
228
  reporter = Parsanol::ErrorReporter::Tree.new
214
229
  source = Parsanol::Source.new(input)
215
230
  success, value = grammar.run_with_context(source, reporter, true)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parsanol
4
- VERSION = "1.3.21"
4
+ VERSION = "1.3.23"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsanol
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.21
4
+ version: 1.3.23
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.