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 +4 -4
- data/Cargo.lock +8 -8
- data/Cargo.toml +1 -1
- data/lib/parsanol/grammar_builder.rb +1 -1
- data/lib/parsanol/native/batch_decoder.rb +1 -2
- data/lib/parsanol/native/types.rb +0 -13
- data/lib/parsanol/native.rb +7 -19
- data/lib/parsanol/options/zero_copy.rb +1 -2
- data/lib/parsanol/slice.rb +1 -1
- data/lib/parsanol/source/line_cache.rb +0 -7
- 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: 4db89a80339a628a73fff78b0c139b82378a3264e2009021ef2665fe40717731
|
|
4
|
+
data.tar.gz: f3be215e5a7c60837082916d36acba8443715206dcf3d5b875f5372c7c4ec985
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
309
|
-
source = "git+https://github.com/parsanol/parsanol-rs?branch=main#
|
|
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.
|
|
326
|
-
source = "git+https://github.com/parsanol/parsanol-rs?branch=main#
|
|
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.
|
|
386
|
-
source = "git+https://github.com/oxidize-rb/rb-sys.git?rev=
|
|
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.
|
|
394
|
-
source = "git+https://github.com/oxidize-rb/rb-sys.git?rev=
|
|
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 = "
|
|
15
|
+
rb-sys = { git = "https://github.com/oxidize-rb/rb-sys.git", rev = "daa12b6521a0c442a705d7f9a929029119aab1d6" }
|
|
@@ -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
|
|
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
|
data/lib/parsanol/native.rb
CHANGED
|
@@ -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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
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
|
|
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. " \
|
data/lib/parsanol/slice.rb
CHANGED
|
@@ -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
|
data/lib/parsanol/version.rb
CHANGED