parsanol 1.3.93-aarch64-linux → 1.3.94-aarch64-linux
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/lib/parsanol/parg/artifact.rb +6 -2
- data/lib/parsanol/parg/compiler.rb +31 -0
- data/lib/parsanol/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e0c1efcdfb93af513ae908d45c90b6f2d6c42015fb643e474bffbb37ae39316
|
|
4
|
+
data.tar.gz: 86ad51bce683affc8b5b94426151bf56694c41fa87b91c9e56c98b7e801c1efc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b5aea575e016166e39822daa41c36c9ef80da76c121610231c6c359071d31362f4e5ed0efd24b4278d8db896ff70f7702e71cbfdf5d4ff4e2f36469222e5085
|
|
7
|
+
data.tar.gz: b89fe36dabaa496b63c7bb220bd5c40c5698fbc3ecac8329359d53d2319ec56df283accc410e15fcfe14d8e0729cbfd876e58c6de382079ce716f1f94e795725
|
|
@@ -152,12 +152,16 @@ module Parsanol
|
|
|
152
152
|
|
|
153
153
|
# Run an external test list (suite files yield Document::Test
|
|
154
154
|
# structs; embedded tests are artifact-shaped hashes).
|
|
155
|
-
|
|
155
|
+
# parse_with overrides how the input is turned into a shape
|
|
156
|
+
# (the envelope self-test drives the baked grammar JSON natively
|
|
157
|
+
# instead of root_atom's source rebuild); bindings and
|
|
158
|
+
# expectations still flow through the standard surface.
|
|
159
|
+
def run_test_list(tests, mode: :native, parse_with: nil)
|
|
156
160
|
tests.filter_map do |test|
|
|
157
161
|
hash = test.is_a?(Document::Test) ? test_to_hash(test) : test
|
|
158
162
|
entry_name = hash["entry"] || entries.first
|
|
159
163
|
begin
|
|
160
|
-
shape = parse(entry_name, hash["input"], mode: mode)
|
|
164
|
+
shape = parse_with ? parse_with.call(hash["input"]) : parse(entry_name, hash["input"], mode: mode)
|
|
161
165
|
case hash["kind"]
|
|
162
166
|
when "reject"
|
|
163
167
|
"test #{hash['input'].inspect}: expected the input to be rejected"
|
|
@@ -76,9 +76,40 @@ module Parsanol
|
|
|
76
76
|
raise CompileError, failures.join("\n") unless failures.empty?
|
|
77
77
|
|
|
78
78
|
envelope = build_envelope
|
|
79
|
+
failures = self.class.self_test(envelope, tables_dir: @tables_dir)
|
|
80
|
+
raise CompileError, failures.join("\n") unless failures.empty?
|
|
81
|
+
|
|
79
82
|
Result.new(@atom_cache, @warnings, envelope)
|
|
80
83
|
end
|
|
81
84
|
|
|
85
|
+
# Bake-time self-test (parsanol-ruby#223): replay the grammar's
|
|
86
|
+
# embedded tests against the BAKED ENVELOPE atom JSON, not the
|
|
87
|
+
# source this process just compiled. A bake that drops or
|
|
88
|
+
# rewrites a member (the 1.3.91 ordered-choice class) makes the
|
|
89
|
+
# envelope disagree with its own tests, and every Ruby-side
|
|
90
|
+
# parse path would mask it — root_atom rebuilds from the
|
|
91
|
+
# embedded source, so only the native engine's JSON registration
|
|
92
|
+
# executes the atom graph a wasm/rs consumer actually runs.
|
|
93
|
+
# Skips (empty) when the native engine is unavailable; the CI
|
|
94
|
+
# and release bakes always have it. Returns failure descriptions.
|
|
95
|
+
def self.self_test(envelope, tables_dir: nil)
|
|
96
|
+
tests = envelope["tests"].to_a
|
|
97
|
+
return [] if tests.empty?
|
|
98
|
+
return [] unless Native.available?
|
|
99
|
+
|
|
100
|
+
artifact = Artifact.from_json(JSON.generate(envelope), tables_dir: tables_dir)
|
|
101
|
+
default = envelope["default_entry"] || artifact.entries.first
|
|
102
|
+
grammars = {}
|
|
103
|
+
tests.filter_map do |test|
|
|
104
|
+
entry = test["entry"] || default
|
|
105
|
+
grammar_json = (grammars[entry] ||= JSON.generate(artifact.entry(entry)["grammar"]))
|
|
106
|
+
artifact.run_test_list(
|
|
107
|
+
[test],
|
|
108
|
+
parse_with: ->(input) { Native.parse_json_grammar(grammar_json, input) },
|
|
109
|
+
)
|
|
110
|
+
end.flatten
|
|
111
|
+
end
|
|
112
|
+
|
|
82
113
|
def resolve_custom(name)
|
|
83
114
|
class_name = @document.customs.fetch(name)
|
|
84
115
|
klass = Object.const_get(class_name)
|
data/lib/parsanol/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.94
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A small Ruby library for constructing parsers in the PEG (Parsing Expression
|
|
14
14
|
Grammar) fashion. Parsanol provides Parslet-compatible API with additional features
|