parsanol 1.3.23 → 1.3.24

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: '09e8cbdb35f892fc514bed1dbcade3fdbb9a3da37a36e021e75b55c3599da2fd'
4
- data.tar.gz: 6ccb6c8bdd584e209d2fac37e8ebf1ed5c597546608cc57d93d12c62ba4c6255
3
+ metadata.gz: 0bc2202f0fc776a4211bfdb92685bef4060456ed45f2dcc7d1a6da101ea43b6d
4
+ data.tar.gz: 9fcbbedcd54b53cee1fdf09ff749f3f61f247288f71c5e74ca7684b357603093
5
5
  SHA512:
6
- metadata.gz: 4edb7d59e2e1cd68284b49260240d09b3e43d9065508a1b93209d5ed3455b210b611f4e75b7c11bd9af823c0277d26a796252599e59a082b7d34b189e9c541c5
7
- data.tar.gz: bae0c17ddd24ef7364594a1c82a65a3a8e510ea307f4630e67d6d8c140726153d016d66a9b13ce158c62d123764ab9a4385888689f145ed8b014964ef1073d0f
6
+ metadata.gz: 959e445f1d28863e471658e332596a0c9ad254cad3272011841e29305c27449760c1330bfd7165d8cd81d7dedc44e48d38c582badf1b1592b5b02a16fcfe45f4
7
+ data.tar.gz: ecbaada2b340858f93b22bd30a0065ec5183e688d14783de1cba0b74ba591b9680eeebbc3798302e069c323467197f38809a9fbbf7422a7e12c72e4693add9e8
data/Cargo.lock CHANGED
@@ -253,6 +253,7 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
253
253
  [[package]]
254
254
  name = "parsanol"
255
255
  version = "0.5.1"
256
+ source = "git+https://github.com/parsanol/parsanol-rs?branch=main#0191b5c95ae0808957bd771a68387599f488cb61"
256
257
  dependencies = [
257
258
  "ahash",
258
259
  "getrandom 0.3.4",
@@ -269,6 +270,7 @@ dependencies = [
269
270
  [[package]]
270
271
  name = "parsanol-derive"
271
272
  version = "0.5.1"
273
+ source = "git+https://github.com/parsanol/parsanol-rs?branch=main#0191b5c95ae0808957bd771a68387599f488cb61"
272
274
  dependencies = [
273
275
  "proc-macro2",
274
276
  "quote",
@@ -246,6 +246,21 @@ module Parsanol
246
246
  raise_native_parse_error(e, grammar_json, input)
247
247
  end
248
248
 
249
+ # Prefix-mode parse (partial match allowed): the grammar registers
250
+ # by handle exactly like #parse; the Rust side returns
251
+ # [value, end_pos] with trailing input unconsumed.
252
+ def parse_prefix(grammar, input)
253
+ handle = Parser.grammar_handle(grammar)
254
+
255
+ begin
256
+ value, end_pos = _parse_handle_prefix(handle, input)
257
+ [value, end_pos]
258
+ rescue ArgumentError
259
+ Parser.invalidate_handle(handle)
260
+ _parse_handle_prefix(Parser.grammar_handle(grammar), input)
261
+ end
262
+ end
263
+
249
264
  # Grammar-atom path: registers once and parses by Rust-side handle,
250
265
  # so steady-state calls marshal no JSON and copy no input string.
251
266
  def parse_atom_grammar(grammar, input)
@@ -123,8 +123,7 @@ module Parsanol
123
123
  # forwarding options via super produces; :mode must be honored
124
124
  # wherever it appears, or those callers silently get the native path.
125
125
  mode = opts.delete(:mode) ||
126
- (if Parsanol::Native.available? && !opts.key?(:prefix) &&
127
- !opts.key?(:reporter)
126
+ (if Parsanol::Native.available? && !opts.key?(:reporter)
128
127
  :native
129
128
  else
130
129
  :ruby
@@ -219,6 +218,11 @@ module Parsanol
219
218
  #
220
219
  def parse_native(input, opts)
221
220
  if Parsanol::Native.available?
221
+ if opts.key?(:prefix) && opts[:prefix]
222
+ value, _end_pos = Parsanol::Native.parse_prefix(root, input)
223
+ return value
224
+ end
225
+
222
226
  Parsanol::Native.parse(root, input)
223
227
  else
224
228
  Parsanol::Atoms::Base.instance_method(:parse).bind_call(self, input,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parsanol
4
- VERSION = "1.3.23"
4
+ VERSION = "1.3.24"
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.23
4
+ version: 1.3.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.