parsanol 1.3.50 → 1.3.52
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 +14 -7
- data/Cargo.toml +1 -1
- data/Rakefile +19 -0
- data/ext/parsanol_cdylib/Cargo.toml +15 -0
- data/ext/parsanol_cdylib/src/lib.rs +12 -0
- data/lib/parsanol/native/transformer.rb +12 -13
- data/lib/parsanol/version.rb +1 -1
- data/parsanol.gemspec +12 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 121bbd1e92041f8eba05a08427343d6f74dbfd02ba3d82f2f33bb9575647fc4e
|
|
4
|
+
data.tar.gz: 378d4b94192baa839526d54fcbaa102ff473b94c1bdaad15b8727b3b73405247
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b958e444c7c0ea0ff4dcc8830a52059debc5bdc6133e92fa315fe6519c9ac5462daa8ef4050ab69984cd8af57af87c3670f8bf73896cfb48c3851cfb3e84b7a8
|
|
7
|
+
data.tar.gz: 0ecf0b94dda3789953ea6e5f00ac21222d958b3427031aa67495d58fa05bf6a509e048983b3271f72a43dd92be1b2b26cb123e360b4d9aa7eebde68725b2d65e
|
data/Cargo.lock
CHANGED
|
@@ -139,9 +139,9 @@ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
|
|
|
139
139
|
|
|
140
140
|
[[package]]
|
|
141
141
|
name = "hashbrown"
|
|
142
|
-
version = "0.
|
|
142
|
+
version = "0.17.1"
|
|
143
143
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
-
checksum = "
|
|
144
|
+
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|
145
145
|
dependencies = [
|
|
146
146
|
"allocator-api2",
|
|
147
147
|
"equivalent",
|
|
@@ -252,9 +252,9 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
|
252
252
|
|
|
253
253
|
[[package]]
|
|
254
254
|
name = "parsanol"
|
|
255
|
-
version = "0.8.
|
|
255
|
+
version = "0.8.8"
|
|
256
256
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
257
|
-
checksum = "
|
|
257
|
+
checksum = "5709d5bc971fa4e28fccf401709ab1d275d180e447e3ab82fde7ebef2ecc787b"
|
|
258
258
|
dependencies = [
|
|
259
259
|
"ahash",
|
|
260
260
|
"getrandom 0.3.4",
|
|
@@ -269,13 +269,20 @@ dependencies = [
|
|
|
269
269
|
|
|
270
270
|
[[package]]
|
|
271
271
|
name = "parsanol-derive"
|
|
272
|
-
version = "0.8.
|
|
272
|
+
version = "0.8.8"
|
|
273
273
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
-
checksum = "
|
|
274
|
+
checksum = "93258404b7032b85dffd9a60e3fb1ed003a268282b4f3385f1ab1aba98db34e5"
|
|
275
275
|
dependencies = [
|
|
276
276
|
"proc-macro2",
|
|
277
277
|
"quote",
|
|
278
|
-
"syn
|
|
278
|
+
"syn 3.0.6",
|
|
279
|
+
]
|
|
280
|
+
|
|
281
|
+
[[package]]
|
|
282
|
+
name = "parsanol_cdylib"
|
|
283
|
+
version = "1.3.50"
|
|
284
|
+
dependencies = [
|
|
285
|
+
"parsanol",
|
|
279
286
|
]
|
|
280
287
|
|
|
281
288
|
[[package]]
|
data/Cargo.toml
CHANGED
data/Rakefile
CHANGED
|
@@ -64,6 +64,25 @@ namespace :gem do
|
|
|
64
64
|
sh "rake gem:platform:any gem"
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
# Vendor the pure-portable cdylib into PLATFORM gems (TODO.perf/9):
|
|
68
|
+
# the ruby (source) gem stays binary-free; each cross-gem carries its
|
|
69
|
+
# own triple's libparsanol next to the extension for the ffi tier
|
|
70
|
+
# (MRI resilience fallback, TruffleRuby native).
|
|
71
|
+
desc "Build ext/parsanol_cdylib for the active cross target and vendor it"
|
|
72
|
+
task "vendor_cdylib" do
|
|
73
|
+
triplet = ENV["CARGO_BUILD_TARGET"] || ENV.fetch("RUST_TARGET", nil)
|
|
74
|
+
args = ["cargo", "build", "--release", "-p", "parsanol_cdylib"]
|
|
75
|
+
args += ["--target", triplet] if triplet
|
|
76
|
+
sh(*args)
|
|
77
|
+
dir = triplet ? "target/#{triplet}/release" : "target/release"
|
|
78
|
+
name = %w[libparsanol.so libparsanol.dylib parsanol.dll]
|
|
79
|
+
.map { |n| File.join(dir, n) }
|
|
80
|
+
.find { |f| File.file?(f) }
|
|
81
|
+
raise "cdylib not found under #{dir}" unless name
|
|
82
|
+
|
|
83
|
+
cp name, "lib/parsanol/native/"
|
|
84
|
+
end
|
|
85
|
+
|
|
67
86
|
desc "Define the gem task to build on any platform (compile on install)"
|
|
68
87
|
task "platform:any" do
|
|
69
88
|
spec = Gem::Specification.load("parsanol.gemspec").dup
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "parsanol_cdylib"
|
|
3
|
+
version = "1.3.52"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
description = "Vendored cdylib for parsanol platform gems: the pure-portable C ABI (no magnus) for the ffi tier"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
publish = false
|
|
8
|
+
|
|
9
|
+
[lib]
|
|
10
|
+
name = "parsanol"
|
|
11
|
+
crate-type = ["cdylib"]
|
|
12
|
+
doc = false
|
|
13
|
+
|
|
14
|
+
[dependencies]
|
|
15
|
+
parsanol = { version = "0.8.8" }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//! Vendored cdylib twin of parsanol-rs's `parsanol-ffi` crate, living in
|
|
2
|
+
//! the gem's ext workspace so the cross-gem build matrix can compile it
|
|
3
|
+
//! per platform triple. Mirrors parsanol-ffi: linking the rlib publishes
|
|
4
|
+
//! the `#[no_mangle] parsanol_c_*` exports; no wrappers.
|
|
5
|
+
|
|
6
|
+
// Force the dependency into the link even under aggressive stripping.
|
|
7
|
+
// Keep in sync with parsanol-rs parsanol-ffi/src/lib.rs.
|
|
8
|
+
#[allow(unused_imports)]
|
|
9
|
+
use parsanol::ffi::c::{
|
|
10
|
+
parsanol_c_last_error, parsanol_c_parse, parsanol_c_parse_len, parsanol_c_register,
|
|
11
|
+
parsanol_c_release,
|
|
12
|
+
};
|
|
@@ -18,8 +18,6 @@ module Parsanol
|
|
|
18
18
|
#
|
|
19
19
|
class AstTransformer
|
|
20
20
|
# Frozen string constants for tag comparisons (avoid allocations)
|
|
21
|
-
SEQUENCE_TAG = ":sequence"
|
|
22
|
-
REPETITION_TAG = ":repetition"
|
|
23
21
|
EMPTY_STRING = ""
|
|
24
22
|
EMPTY_ARRAY = [].freeze
|
|
25
23
|
EMPTY_HASH = {}.freeze
|
|
@@ -28,11 +26,12 @@ module Parsanol
|
|
|
28
26
|
# This is a class variable to share across all transformations
|
|
29
27
|
@@symbol_cache = {}
|
|
30
28
|
|
|
31
|
-
#
|
|
29
|
+
# Envelope tags. Both tiers (extension objects and the flat-u64
|
|
30
|
+
# batch wire) deliver Symbols — the encoder writes ':'-prefixed
|
|
31
|
+
# strings as TAG_SYMBOL — so there is exactly one tag form.
|
|
32
32
|
SEQUENCE_SYM = :sequence
|
|
33
33
|
REPETITION_SYM = :repetition
|
|
34
34
|
MAYBE_SYM = :maybe
|
|
35
|
-
MAYBE_TAG = ":maybe"
|
|
36
35
|
|
|
37
36
|
# `named` mirrors CanFlatten#flatten's named flag: inside a Named
|
|
38
37
|
# result (.as), an absent maybe flattens to nil; unnamed it flattens
|
|
@@ -67,7 +66,8 @@ module Parsanol
|
|
|
67
66
|
# Check if this is a tagged array from native parser
|
|
68
67
|
# Native parser produces Symbol tags: [:sequence, item1, item2, ...]
|
|
69
68
|
first = arr.first
|
|
70
|
-
|
|
69
|
+
case first
|
|
70
|
+
when SEQUENCE_SYM
|
|
71
71
|
# Optimized: transform items starting from index 1
|
|
72
72
|
# Avoid creating arr[1..] slice
|
|
73
73
|
len = arr.length
|
|
@@ -80,7 +80,7 @@ module Parsanol
|
|
|
80
80
|
i += 1
|
|
81
81
|
end
|
|
82
82
|
flatten_sequence(items)
|
|
83
|
-
|
|
83
|
+
when REPETITION_SYM
|
|
84
84
|
# Optimized: transform items starting from index 1
|
|
85
85
|
len = arr.length
|
|
86
86
|
# Empty repetition: named → [], unnamed → "" (CanFlatten#flatten_repetition)
|
|
@@ -93,7 +93,7 @@ module Parsanol
|
|
|
93
93
|
i += 1
|
|
94
94
|
end
|
|
95
95
|
flatten_repetition(items, named: named)
|
|
96
|
-
|
|
96
|
+
when MAYBE_SYM
|
|
97
97
|
# Maybe flattens to nil-or-value (named) or ""-or-value (unnamed),
|
|
98
98
|
# never to an array
|
|
99
99
|
len = arr.length
|
|
@@ -103,7 +103,7 @@ module Parsanol
|
|
|
103
103
|
flattened = transform(arr[1])
|
|
104
104
|
named ? flattened : (flattened || EMPTY_STRING)
|
|
105
105
|
end
|
|
106
|
-
|
|
106
|
+
when Symbol
|
|
107
107
|
# Other tagged arrays - pass through
|
|
108
108
|
arr.map { |item| transform(item) }
|
|
109
109
|
else
|
|
@@ -138,11 +138,10 @@ module Parsanol
|
|
|
138
138
|
# Transform the value
|
|
139
139
|
transformed = transform(value, named: true)
|
|
140
140
|
|
|
141
|
-
#
|
|
142
|
-
#
|
|
143
|
-
# ":repetition" Strings — accept both.
|
|
141
|
+
# Tagged repetition from the native parser (Symbol tag; both
|
|
142
|
+
# tiers deliver the same form).
|
|
144
143
|
is_tagged_repetition = value.is_a?(Array) && !value.empty? &&
|
|
145
|
-
|
|
144
|
+
value.first.equal?(REPETITION_SYM)
|
|
146
145
|
|
|
147
146
|
# Check RAW value for repetition pattern BEFORE transformation
|
|
148
147
|
# (bare repeated sibling captures, #36): array items that all
|
|
@@ -297,7 +296,7 @@ module Parsanol
|
|
|
297
296
|
sym_key = cached_symbol(key)
|
|
298
297
|
|
|
299
298
|
is_repetition = value.is_a?(Array) && !value.empty? &&
|
|
300
|
-
value.first.
|
|
299
|
+
value.first.equal?(REPETITION_SYM)
|
|
301
300
|
|
|
302
301
|
transformed = transform(value, named: true)
|
|
303
302
|
|
data/lib/parsanol/version.rb
CHANGED
data/parsanol.gemspec
CHANGED
|
@@ -39,7 +39,18 @@ Gem::Specification.new do |spec|
|
|
|
39
39
|
Cargo.lock
|
|
40
40
|
]
|
|
41
41
|
spec.files.reject! { |f| File.directory?(f) }
|
|
42
|
-
|
|
42
|
+
# Cargo build trees are never gem content (a dirty local
|
|
43
|
+
# ext/parsanol_native/target once inflated a build to 218 MB).
|
|
44
|
+
spec.files.reject! { |f| f.include?("/target/") || f.start_with?("target/") }
|
|
45
|
+
# Binaries are never tracked in git, and the ruby (source) gem stays
|
|
46
|
+
# slim: the pure-portable cdylib is vendored ONLY into platform gems
|
|
47
|
+
# by the cross-gem build (rake gem:vendor_cdylib), never by a plain
|
|
48
|
+
# `gem build`.
|
|
49
|
+
spec.files.reject! do |f|
|
|
50
|
+
f =~ /\.(dll|so|dylib|lib|bundle)\Z/ &&
|
|
51
|
+
!(ENV["PARSANOL_VENDOR_CDYLIB"] == "1" &&
|
|
52
|
+
f =~ %r{\Alib/parsanol/native/libparsanol\.(so|dylib|dll)\Z})
|
|
53
|
+
end
|
|
43
54
|
spec.require_paths = ["lib"]
|
|
44
55
|
|
|
45
56
|
spec.required_ruby_version = ">= 3.2.0"
|
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.
|
|
4
|
+
version: 1.3.52
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -40,6 +40,8 @@ files:
|
|
|
40
40
|
- LICENSE
|
|
41
41
|
- README.adoc
|
|
42
42
|
- Rakefile
|
|
43
|
+
- ext/parsanol_cdylib/Cargo.toml
|
|
44
|
+
- ext/parsanol_cdylib/src/lib.rs
|
|
43
45
|
- ext/parsanol_native/Cargo.toml
|
|
44
46
|
- ext/parsanol_native/extconf.rb
|
|
45
47
|
- ext/parsanol_native/src/lib.rs
|