parsanol 1.3.123 → 1.3.124
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 +15 -0
- data/lib/parsanol/parg/document.rb +2 -2
- 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: fd3371b993b77e992ef44c6a12c46460595e88be97b77dadbcef91d891f2edd0
|
|
4
|
+
data.tar.gz: 90780bf0b7e04e9afcec6910327df787d97bb32658e9a4963e9d70c7dc79890a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a85f8d30e83a3ae06d7161e7a3193a4f476f46c32c84e7b4083d6308c486ee21cc69cca41c125b030e6a4330702e0396a0e6563f51643757f366a892fd8e24f8
|
|
7
|
+
data.tar.gz: d55182b8bf7ae973aeaa5ccb20b22f0bd7c4e7c878272d6cf42acc88ff0e0c5e87d4b2426bac4ab8e963f10642a69c2f07b052ca88c1bb34343c5d50be9ef50c
|
|
@@ -241,6 +241,7 @@ module Parsanol
|
|
|
241
241
|
end
|
|
242
242
|
"test #{hash['input'].inspect}: expected captures " \
|
|
243
243
|
"#{mismatched.transform_values(&:inspect).inspect}, got #{actuals.inspect}"
|
|
244
|
+
when "bind" then bind_mismatch(entry_name, shape, hash)
|
|
244
245
|
end
|
|
245
246
|
rescue Parsanol::ParseFailed
|
|
246
247
|
unless hash["kind"] == "reject"
|
|
@@ -250,6 +251,20 @@ module Parsanol
|
|
|
250
251
|
end
|
|
251
252
|
end
|
|
252
253
|
|
|
254
|
+
# parsanol-ruby#414: the whole bound map must equal the expectation
|
|
255
|
+
# exactly (not the partial `example` match) — the grammar author
|
|
256
|
+
# pins what the bindings produce, including absent keys and
|
|
257
|
+
# phantom rows.
|
|
258
|
+
def bind_mismatch(entry_name, shape, hash)
|
|
259
|
+
bound = apply_bindings(entry_name, shape)
|
|
260
|
+
actual = Bindings.canonical(bound)
|
|
261
|
+
expected = Bindings.canonical(hash["expect"])
|
|
262
|
+
return nil if actual == expected
|
|
263
|
+
|
|
264
|
+
"test #{hash['input'].inspect}: expected bound #{expected.inspect}, " \
|
|
265
|
+
"got #{actual.inspect}"
|
|
266
|
+
end
|
|
267
|
+
|
|
253
268
|
# Best-effort recovery (TODO.sota/1, R1): on success returns
|
|
254
269
|
# {"ok": true, "shape": tree}; on ParseFailed returns
|
|
255
270
|
# {"ok": false, "error": {"offset", "message"}, "captures":
|
|
@@ -11,9 +11,9 @@ module Parsanol
|
|
|
11
11
|
# `capture` = phase 1 (grammar layer): asserts the raw capture tree,
|
|
12
12
|
# no bindings section needed. `example` = phase 2 (bindings layer):
|
|
13
13
|
# asserts the bound, preprocessed attribute hash.
|
|
14
|
-
TEST_KINDS = %i[accept reject example capture shape].freeze
|
|
14
|
+
TEST_KINDS = %i[accept reject example capture shape bind].freeze
|
|
15
15
|
# Test kinds whose expectations are `{ key: value }` pairs.
|
|
16
|
-
PAIR_KINDS = %w[example capture].freeze
|
|
16
|
+
PAIR_KINDS = %w[example capture bind].freeze
|
|
17
17
|
|
|
18
18
|
Test = Struct.new(:entry, :kind, :input, :expect)
|
|
19
19
|
|
data/lib/parsanol/version.rb
CHANGED