parsanol 1.3.128-arm-linux → 1.3.129-arm-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/bindings.rb +25 -5
- 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: cc5b22c92ad2b6c2155b050c0a904e293758b6ba6a50a4be0ca5f3676f957a2a
|
|
4
|
+
data.tar.gz: f600012d26f0a706a1818980a3f98148c05c8b918ab9457e205cda11abbd39ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 65cd647e2615a8c71cf6cdad62af2cf68180057a48376ec922210823177bec264f354f8a2e71f3bbb850fc9be72819b0c509f9e86d0463f15dd7e3a880adca0d
|
|
7
|
+
data.tar.gz: 1f7a4dd5fec3525487cc74396da93cd146c32a8ab3cc5878fe4ce6a155bead0722489397adff87e4c3dd2747460e2ac99717bb788ce67a33c4e8c17e71905452
|
|
@@ -36,11 +36,14 @@ module Parsanol
|
|
|
36
36
|
# bound map (parsanol-ruby#413): a capture present in the parse
|
|
37
37
|
# but bound nowhere is silent data loss, the one case the
|
|
38
38
|
# binding layer's other checks miss. Absence in the TREE is
|
|
39
|
-
# legitimate optionality and never raises.
|
|
40
|
-
#
|
|
41
|
-
#
|
|
39
|
+
# legitimate optionality and never raises. Delivery is EITHER
|
|
40
|
+
# the binding's own leaf/prefix reaching the map (the capture
|
|
41
|
+
# may rename on the way — capture "doc_year" binds under path
|
|
42
|
+
# "year", parsanol-ruby#434) OR the capture name appearing as a
|
|
43
|
+
# key anywhere in the map: a `(raw)` binding carries its entire
|
|
42
44
|
# subtree, so captures nested inside a raw-bound ancestor are
|
|
43
|
-
# delivered through it (parsanol-ruby#427 — BS 9113
|
|
45
|
+
# delivered through it (parsanol-ruby#427 — BS 9113
|
|
46
|
+
# bundled_list).
|
|
44
47
|
bound_keys = {}
|
|
45
48
|
walk_keys = lambda do |node|
|
|
46
49
|
case node
|
|
@@ -53,7 +56,7 @@ module Parsanol
|
|
|
53
56
|
walk_keys.call(out)
|
|
54
57
|
lost = bindings.select do |binding|
|
|
55
58
|
capture = binding["capture"].to_sym
|
|
56
|
-
present.include?(capture) && !bound_keys.key?(capture)
|
|
59
|
+
present.include?(capture) && !bound?(out, binding) && !bound_keys.key?(capture)
|
|
57
60
|
end
|
|
58
61
|
unless lost.empty?
|
|
59
62
|
raise BindError,
|
|
@@ -63,6 +66,23 @@ module Parsanol
|
|
|
63
66
|
out
|
|
64
67
|
end
|
|
65
68
|
|
|
69
|
+
# Did this binding contribute anything to the bound map? Scalars
|
|
70
|
+
# bind under their leaf key; array groups bind under their prefix.
|
|
71
|
+
# The leaf is the PATH's tail, so a capture-to-path rename reads
|
|
72
|
+
# as delivered when its own path landed (parsanol-ruby#434).
|
|
73
|
+
def bound?(out, binding)
|
|
74
|
+
path = binding["path"].to_s
|
|
75
|
+
if path.include?("[]")
|
|
76
|
+
prefix = path.split("[]").first.to_sym
|
|
77
|
+
rows = out[prefix]
|
|
78
|
+
rows.is_a?(Array) && rows.any? do |row|
|
|
79
|
+
row.is_a?(Hash) && row.key?(leaf_key(binding))
|
|
80
|
+
end
|
|
81
|
+
else
|
|
82
|
+
out.key?(leaf_key(binding))
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
66
86
|
# Canonical test-value form: one equality surface for capture and
|
|
67
87
|
# example expectations on both sides of the comparison (Slice vs
|
|
68
88
|
# source literal was comparing heterogeneous types). Terminals
|
data/lib/parsanol/version.rb
CHANGED