parsanol 1.3.9 → 1.3.10

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: eb19c18264a1e1c6e26dfb2bab0ff9c9fd005f631423b918240a321e2470848a
4
- data.tar.gz: 49af7d190c09e38ec7c46a168e0f2a20bbbfd4afe1d63b006becbe20b69e14f5
3
+ metadata.gz: 4db89a80339a628a73fff78b0c139b82378a3264e2009021ef2665fe40717731
4
+ data.tar.gz: f3be215e5a7c60837082916d36acba8443715206dcf3d5b875f5372c7c4ec985
5
5
  SHA512:
6
- metadata.gz: 58f02929ffcffb52c15fad2545f9fb36076e8396ec04ca90ea5c1d1a8186b5cd242b11fc415127906bccf724d3da3f175ad67c2b54ced828ad61a286802e6648
7
- data.tar.gz: 3581460ba7dd3cd81634ab19fbb405c6220ac6d0084b0c9d1d13a8232d5d700346c560a76b6eaf610ff30c967b506c10fcb87879d4df46a18c2a2615feac261f
6
+ metadata.gz: 9922b36fd81975232080e50a7d4f5b78604349be51a7812ec17d564a027d8f0152e9ec0e764fb57dfda2538cfb7247e3a6bd4d4c10feacdd795d7ffa907ed2ee
7
+ data.tar.gz: 9e7fe2260017d554dcb260c7f3583d31d2da2cdb4081ff049259290d63a65abece0722906982d1c125facd88316502f5d0e82b890e306a6b93d8afc24a9f856f
data/Cargo.lock CHANGED
@@ -305,8 +305,8 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
305
305
 
306
306
  [[package]]
307
307
  name = "parsanol"
308
- version = "0.5.0"
309
- source = "git+https://github.com/parsanol/parsanol-rs?branch=main#99a5a2f3fa292ce506cda9ea7a6d5403abd5e8a0"
308
+ version = "0.5.1"
309
+ source = "git+https://github.com/parsanol/parsanol-rs?branch=main#6de2f6877b75c3d4ab2d73dd75cf32405e1f5505"
310
310
  dependencies = [
311
311
  "ahash",
312
312
  "getrandom 0.3.4",
@@ -322,8 +322,8 @@ dependencies = [
322
322
 
323
323
  [[package]]
324
324
  name = "parsanol-derive"
325
- version = "0.5.0"
326
- source = "git+https://github.com/parsanol/parsanol-rs?branch=main#99a5a2f3fa292ce506cda9ea7a6d5403abd5e8a0"
325
+ version = "0.5.1"
326
+ source = "git+https://github.com/parsanol/parsanol-rs?branch=main#6de2f6877b75c3d4ab2d73dd75cf32405e1f5505"
327
327
  dependencies = [
328
328
  "proc-macro2",
329
329
  "quote",
@@ -382,16 +382,16 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
382
382
 
383
383
  [[package]]
384
384
  name = "rb-sys"
385
- version = "0.9.124"
386
- source = "git+https://github.com/oxidize-rb/rb-sys.git?rev=b42b5fba0424fcc6778fed9a01e05215eaa53f85#b42b5fba0424fcc6778fed9a01e05215eaa53f85"
385
+ version = "0.9.126"
386
+ source = "git+https://github.com/oxidize-rb/rb-sys.git?rev=daa12b6521a0c442a705d7f9a929029119aab1d6#daa12b6521a0c442a705d7f9a929029119aab1d6"
387
387
  dependencies = [
388
388
  "rb-sys-build",
389
389
  ]
390
390
 
391
391
  [[package]]
392
392
  name = "rb-sys-build"
393
- version = "0.9.124"
394
- source = "git+https://github.com/oxidize-rb/rb-sys.git?rev=b42b5fba0424fcc6778fed9a01e05215eaa53f85#b42b5fba0424fcc6778fed9a01e05215eaa53f85"
393
+ version = "0.9.126"
394
+ source = "git+https://github.com/oxidize-rb/rb-sys.git?rev=daa12b6521a0c442a705d7f9a929029119aab1d6#daa12b6521a0c442a705d7f9a929029119aab1d6"
395
395
  dependencies = [
396
396
  "bindgen",
397
397
  "lazy_static",
data/Cargo.toml CHANGED
@@ -12,4 +12,4 @@ debug = true
12
12
  [patch.crates-io]
13
13
  magnus = { git = "https://github.com/matsadler/magnus", rev = "4e46772" }
14
14
  magnus-macros = { git = "https://github.com/matsadler/magnus", rev = "4e46772" }
15
- rb-sys = { git = "https://github.com/oxidize-rb/rb-sys.git", rev = "b42b5fba0424fcc6778fed9a01e05215eaa53f85" }
15
+ rb-sys = { git = "https://github.com/oxidize-rb/rb-sys.git", rev = "daa12b6521a0c442a705d7f9a929029119aab1d6" }
@@ -115,7 +115,7 @@ module Parsanol
115
115
  # Convert to JSON for native parser
116
116
  #
117
117
  # @return [String] JSON representation
118
- def to_json(*_args)
118
+ def to_json(*)
119
119
  build.to_json
120
120
  end
121
121
 
@@ -57,9 +57,8 @@ module Parsanol
57
57
  # pre-decoded Ruby value from _parse_raw
58
58
  # @param input [String] Original input string (for Slice references)
59
59
  # @param slice_class [Class] The Slice class to use
60
- # @param grammar_atom [Parsanol::Atoms::Base] The grammar atom (unused, kept for API compat)
61
60
  # @return [Object] Transformed Ruby AST
62
- def decode_and_flatten(data, input, slice_class, _grammar_atom)
61
+ def decode_and_flatten(data, input, slice_class)
63
62
  # Check if data is batch data (flat u64 array) or already a Ruby value
64
63
  if data.is_a?(Integer) || (data.is_a?(Array) && data.first.is_a?(Integer))
65
64
  # Batch data (flat u64 array) - decode first, then transform
@@ -25,18 +25,5 @@ module Parsanol
25
25
  EMPTY_ARRAY = [].freeze
26
26
  EMPTY_HASH = {}.freeze
27
27
  end
28
-
29
- # Symbol cache to avoid repeated string-to-symbol conversions
30
- # This is a class variable to share across all transformations
31
- @@symbol_cache = {}
32
-
33
- # Convert string key to symbol with caching
34
- # @param key [String, Symbol] The key to convert
35
- # @return [Symbol] The symbol version of the key
36
- def self.cached_symbol(key)
37
- return key if key.is_a?(Symbol)
38
-
39
- @@symbol_cache[key] ||= key.to_sym
40
- end
41
28
  end
42
29
  end
@@ -10,8 +10,6 @@ require "parsanol/native/batch_decoder"
10
10
 
11
11
  module Parsanol
12
12
  module Native
13
- VERSION = "0.1.0"
14
-
15
13
  class << self
16
14
  # Check if native extension is available
17
15
  def available?
@@ -41,20 +39,17 @@ module Parsanol
41
39
  raise LoadError, "Native parser not available" unless available?
42
40
 
43
41
  # Handle both grammar atoms and pre-serialized JSON strings
44
- if grammar.is_a?(String)
45
- grammar_json = grammar
46
- grammar_atom = nil
47
- else
48
- grammar_json = Parser.serialize_grammar(grammar)
49
- grammar_atom = grammar
50
- end
42
+ grammar_json = if grammar.is_a?(String)
43
+ grammar
44
+ else
45
+ Parser.serialize_grammar(grammar)
46
+ end
51
47
 
52
48
  # Use _parse_raw which returns properly tagged Ruby arrays via transform_ast.
53
49
  # The batch format doesn't preserve :repetition/:sequence tags, so we use
54
50
  # the direct FFI path. Apply the Ruby transformer to handle tags correctly.
55
51
  raw_ast = _parse_raw(grammar_json, input)
56
- BatchDecoder.decode_and_flatten(raw_ast, input, Parsanol::Slice,
57
- grammar_atom)
52
+ BatchDecoder.decode_and_flatten(raw_ast, input, Parsanol::Slice)
58
53
  end
59
54
 
60
55
  # Memory-bounded parsing without packrat cache.
@@ -75,7 +70,7 @@ module Parsanol
75
70
  end
76
71
 
77
72
  raw_ast = _parse_fresh_raw(grammar_json, input)
78
- BatchDecoder.decode_and_flatten(raw_ast, input, Parsanol::Slice, grammar)
73
+ BatchDecoder.decode_and_flatten(raw_ast, input, Parsanol::Slice)
79
74
  end
80
75
 
81
76
  # Parse and return RAW AST without transformation.
@@ -187,13 +182,6 @@ module Parsanol
187
182
  end
188
183
  stats
189
184
  end
190
-
191
- private
192
-
193
- # Get the Slice class
194
- def get_slice_class
195
- Parsanol::Slice
196
- end
197
185
  end
198
186
  end
199
187
  end
@@ -89,11 +89,10 @@ module Parsanol
89
89
  # Parse input and return direct Ruby objects (no serialization)
90
90
  #
91
91
  # @param input [String] The input string to parse
92
- # @param options [Hash] Parse options (ignored for zero-copy)
93
92
  # @return [Object] Direct Ruby object (type depends on grammar)
94
93
  # @raise [LoadError] If native extension not available
95
94
  # @raise [Parsanol::ParseFailed] If parsing fails
96
- def parse(input, _options = {})
95
+ def parse(input)
97
96
  unless Parsanol::Native.available?
98
97
  raise LoadError,
99
98
  "ZeroCopy mode requires native extension for direct FFI object construction. " \
@@ -114,7 +114,7 @@ module Parsanol
114
114
  as_json.to_json(*)
115
115
  end
116
116
 
117
- def as_json(_options = {})
117
+ def as_json
118
118
  result = { "value" => content, "offset" => offset, "length" => length }
119
119
  if @input
120
120
  line, column = line_and_column
@@ -97,13 +97,6 @@ module Parsanol
97
97
  return hi if hi <= lo
98
98
  end
99
99
  end
100
-
101
- # Legacy method name for backward compatibility
102
- alias find_mid midpoint_index
103
- alias lbound lower_bound_index
104
100
  end
105
-
106
- # Legacy constant name for backward compatibility
107
- RangeSearch = IntervalLookup
108
101
  end
109
102
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parsanol
4
- VERSION = "1.3.9"
4
+ VERSION = "1.3.10"
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.9
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.