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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd9773776674bd865171d5b4b378628a063b0dee92e2a4442fcf3fe0182262da
4
- data.tar.gz: 6e8554e163d07070a54b9255d6bed7ca348fd72fd6a8968a17308814323d0d4c
3
+ metadata.gz: f6eac7cb7780cfacc7d2a1989e6cea0ee26edc13f3e2d133cefc4f363a8f3e2e
4
+ data.tar.gz: 6629c13a4cdbf3fea6378028ae736e49a547688443769278e9583bf508462087
5
5
  SHA512:
6
- metadata.gz: fa0c3526c5ab79f7d9b6ed08e7523738cf6b46e2b8a6c30e2a021845d6bdeeabd5bb3e7ddd4d31f36725c1682ad94e650975289889c1bc991364d48bd9e2c8d7
7
- data.tar.gz: ea7fd569d5a432d56583d76ec896c5a0c03ab8b769d9af7863041f02e64343ce1280ee226f450efde730bcb98bb4a0391fb7fcd03d3f490c7e35b133f6f427e1
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.13.0"
310
+ version = "0.14.0"
311
311
  source = "registry+https://github.com/rust-lang/crates.io-index"
312
- checksum = "126b715ffe53b3bc75ed8ff753333e350d51aaea64a0a51a6eb8588f0786d925"
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.13.0"
329
+ version = "0.14.0"
330
330
  source = "registry+https://github.com/rust-lang/crates.io-index"
331
- checksum = "6f1413076b79ef60c0af56973f8bbfddcc6034bd3cb47fbc5205fcd188bc8d79"
331
+ checksum = "8ebddcf7d0b843657a5699f3cdeb7805bc934fcb8df24c6ab460d4dd345562d1"
332
332
  dependencies = [
333
333
  "proc-macro2",
334
334
  "quote",
@@ -12,5 +12,5 @@ crate-type = ["cdylib"]
12
12
  doc = false
13
13
 
14
14
  [dependencies]
15
- # 0.13 carries rs#174 + rs#172 (Trivia diagnostics parity)
16
- parsanol = { version = "0.13" }
15
+ # 0.14.0 carries the TriviaCapture atom (native capture parity)
16
+ parsanol = { version = "0.14.0" }
@@ -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.13 carries the rs#172 Trivia
33
- # atom: native diagnostics skip trivia positions, matching ruby #145)
34
- parsanol = { version = "0.13.0", features = ["ruby"] }
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 is_repetition
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parsanol
4
- VERSION = "1.3.72"
4
+ VERSION = "1.3.74"
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.72
4
+ version: 1.3.74
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.