xmp2assert 3 → 4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xmp2assert/converter.rb +40 -3
- data/lib/xmp2assert/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a15f8a34b7183990bbd04f98d8f5b1fcc54cb9c
|
4
|
+
data.tar.gz: 7d04d08869fb960cf5ba2e5d5729be6b370ddc66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e2b16bb8de650a087f79498a57f74ccdf1c6a881be820de74eec8cc7a361b7ab4a7df7de77e8e427d8c507d9768dc68381d820a8ba2f3fcfd7ec0c3f5db9fae
|
7
|
+
data.tar.gz: 65c30d860c41290b76038f0f76aec79a3ec3e67d8070f709fa354d76057967234c6a19e222d6bf89dba633075c9bdc74a2e088b01723318020a49cbefb50eeb6
|
data/lib/xmp2assert/converter.rb
CHANGED
@@ -142,12 +142,49 @@ class XMP2Assert::Converter
|
|
142
142
|
|
143
143
|
def need_paren? list
|
144
144
|
start = list.first.to_sym.to_s
|
145
|
-
stop = list.last .to_sym.to_s
|
146
145
|
|
147
146
|
if %r/(.+)_beg$/ =~ start then
|
148
|
-
|
147
|
+
t = $1
|
148
|
+
list.inject 0 do |i, tok|
|
149
|
+
tt = tok.to_sym.to_s
|
150
|
+
if %r/#{t}_beg$/ =~ tt
|
151
|
+
next i + 1
|
152
|
+
elsif %r/#{t}_end$/ =~ tt
|
153
|
+
j = i - 1
|
154
|
+
if j > 0 then
|
155
|
+
next j
|
156
|
+
elsif tok == list.last
|
157
|
+
return false
|
158
|
+
else
|
159
|
+
return true
|
160
|
+
end
|
161
|
+
else
|
162
|
+
next i
|
163
|
+
end
|
164
|
+
end
|
165
|
+
return true
|
166
|
+
|
149
167
|
elsif %r/^l(paren|brace|bracket)$/ =~ start then
|
150
|
-
|
168
|
+
t = $1
|
169
|
+
list.inject 0 do |i, tok|
|
170
|
+
tt = tok.to_sym.to_s
|
171
|
+
if %r/^l#{t}$/ =~ tt
|
172
|
+
next i + 1
|
173
|
+
elsif %r/^r#{t}$/ =~ tt
|
174
|
+
j = i - 1
|
175
|
+
if j > 0 then
|
176
|
+
next j
|
177
|
+
elsif tok == list.last
|
178
|
+
return false
|
179
|
+
else
|
180
|
+
return true
|
181
|
+
end
|
182
|
+
else
|
183
|
+
next i
|
184
|
+
end
|
185
|
+
end
|
186
|
+
return true
|
187
|
+
|
151
188
|
else
|
152
189
|
return true
|
153
190
|
end
|
data/lib/xmp2assert/version.rb
CHANGED