parsanol 1.3.72 → 1.3.74
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 +4 -4
- data/ext/parsanol_cdylib/Cargo.toml +2 -2
- data/ext/parsanol_native/Cargo.toml +3 -3
- data/lib/parsanol/atoms/trivia.rb +2 -0
- data/lib/parsanol/native/serializer.rb +19 -0
- data/lib/parsanol/native/transformer.rb +9 -1
- 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: f6eac7cb7780cfacc7d2a1989e6cea0ee26edc13f3e2d133cefc4f363a8f3e2e
|
|
4
|
+
data.tar.gz: 6629c13a4cdbf3fea6378028ae736e49a547688443769278e9583bf508462087
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5f374af54ca2375e94cd04d9771088b10b383ec046731ff57f2d36da85961d29ba6c2c6af2063e88836980a5bb0c1c4d8fbaaa98af98112e4cbf9b5da4dec39
|
|
7
|
+
data.tar.gz: 6f6f2ee120b8a45fe28a403504cd198225ae4833d4e8925758cc16160a0f64f4c2b005b622fec7bd0ad3ded616f402550edf0fa4893c0858434cbe825d0b48c3
|
data/Cargo.lock
CHANGED
|
@@ -307,9 +307,9 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
|
307
307
|
|
|
308
308
|
[[package]]
|
|
309
309
|
name = "parsanol"
|
|
310
|
-
version = "0.
|
|
310
|
+
version = "0.14.0"
|
|
311
311
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
312
|
-
checksum = "
|
|
312
|
+
checksum = "25d42f7d6475885046f668bdabb6f2f8c13807148811b9d1b618fd00ec07a858"
|
|
313
313
|
dependencies = [
|
|
314
314
|
"ahash",
|
|
315
315
|
"getrandom 0.3.4",
|
|
@@ -326,9 +326,9 @@ dependencies = [
|
|
|
326
326
|
|
|
327
327
|
[[package]]
|
|
328
328
|
name = "parsanol-derive"
|
|
329
|
-
version = "0.
|
|
329
|
+
version = "0.14.0"
|
|
330
330
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
331
|
-
checksum = "
|
|
331
|
+
checksum = "8ebddcf7d0b843657a5699f3cdeb7805bc934fcb8df24c6ab460d4dd345562d1"
|
|
332
332
|
dependencies = [
|
|
333
333
|
"proc-macro2",
|
|
334
334
|
"quote",
|
|
@@ -29,9 +29,9 @@ magnus = { version = "0.9" }
|
|
|
29
29
|
|
|
30
30
|
# parsanol parser library (crates.io; 0.12 carries the rs#174 native
|
|
31
31
|
# backtracking fix: dynamic-dependent memoization + outcome cache)
|
|
32
|
-
# parsanol parser library (crates.io; 0.
|
|
33
|
-
# atom: native
|
|
34
|
-
parsanol = { version = "0.
|
|
32
|
+
# parsanol parser library (crates.io; 0.14.0 carries the TriviaCapture
|
|
33
|
+
# atom: native trivia-capture parity, rs#172/#152)
|
|
34
|
+
parsanol = { version = "0.14.0", features = ["ruby"] }
|
|
35
35
|
|
|
36
36
|
# Logging
|
|
37
37
|
log = "0.4"
|
|
@@ -29,6 +29,8 @@ module Parsanol
|
|
|
29
29
|
# compiler derives markers from each capturer rule's first Str
|
|
30
30
|
# atom, e.g. "//" => :line_comment); units not matching any
|
|
31
31
|
# marker are whitespace-shaped and stay unrecorded.
|
|
32
|
+
attr_reader :capturers
|
|
33
|
+
|
|
32
34
|
def initialize(atom, capturers)
|
|
33
35
|
super(atom)
|
|
34
36
|
@capturers = capturers
|
|
@@ -78,6 +78,15 @@ module Parsanol
|
|
|
78
78
|
serialize_custom_ref(atom)
|
|
79
79
|
when Parsanol::Atoms::Dynamic
|
|
80
80
|
serialize_dynamic(atom)
|
|
81
|
+
when Parsanol::Atoms::TriviaCapture
|
|
82
|
+
# parsanol-ruby#152: the capture wrapper carries
|
|
83
|
+
# its marker table so the native engine records
|
|
84
|
+
# comment-shaped units into the pending channel
|
|
85
|
+
# and attaches them to the next Named capture
|
|
86
|
+
# under `comments:`. A distinct variant keeps the
|
|
87
|
+
# declared gate: engines predating it reject
|
|
88
|
+
# capture-carrying artifacts loudly.
|
|
89
|
+
serialize_trivia_capture(atom)
|
|
81
90
|
when Parsanol::Atoms::Trivia
|
|
82
91
|
# Wire-distinct from Ignore (rs#172): the Rust
|
|
83
92
|
# engine suppresses trivia-position diagnostics by
|
|
@@ -283,6 +292,16 @@ module Parsanol
|
|
|
283
292
|
"parse this grammar with mode: :ruby"
|
|
284
293
|
end
|
|
285
294
|
|
|
295
|
+
def serialize_trivia_capture(atom)
|
|
296
|
+
inner_id = serialize_atom(atom.wrapped_atom)
|
|
297
|
+
{
|
|
298
|
+
"TriviaCapture" => {
|
|
299
|
+
"atom" => inner_id,
|
|
300
|
+
"rules" => atom.capturers.map { |marker, label| [marker, label.to_s] },
|
|
301
|
+
},
|
|
302
|
+
}
|
|
303
|
+
end
|
|
304
|
+
|
|
286
305
|
def serialize_trivia(atom)
|
|
287
306
|
inner_id = serialize_atom(atom.wrapped_atom)
|
|
288
307
|
{
|
|
@@ -298,9 +298,17 @@ module Parsanol
|
|
|
298
298
|
is_repetition = value.is_a?(Array) && !value.empty? &&
|
|
299
299
|
value.first.equal?(REPETITION_SYM)
|
|
300
300
|
|
|
301
|
+
# parsanol-ruby#152: `comments` lists are host-constructed
|
|
302
|
+
# trivia attachments, not parser repetitions — their unit
|
|
303
|
+
# hashes carry the trivia kind key, never the attachment
|
|
304
|
+
# key, so the re-keying below must not wrap them.
|
|
305
|
+
is_trivia_attachment = is_repetition && sym_key == :comments
|
|
306
|
+
|
|
301
307
|
transformed = transform(value, named: true)
|
|
302
308
|
|
|
303
|
-
result[sym_key] = if
|
|
309
|
+
result[sym_key] = if is_trivia_attachment
|
|
310
|
+
transformed
|
|
311
|
+
elsif is_repetition
|
|
304
312
|
if transformed.is_a?(Array)
|
|
305
313
|
if transformed.all? do |item|
|
|
306
314
|
item.is_a?(Hash) && item.key?(sym_key)
|
data/lib/parsanol/version.rb
CHANGED