xmp2assert 3 → 4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37e895dead7be33e2d883950ffc4472e4ed4c49b
4
- data.tar.gz: 81805143514b795409f5258853471d67794f698a
3
+ metadata.gz: 5a15f8a34b7183990bbd04f98d8f5b1fcc54cb9c
4
+ data.tar.gz: 7d04d08869fb960cf5ba2e5d5729be6b370ddc66
5
5
  SHA512:
6
- metadata.gz: 974409606e9bc0812d5d01ba91329b51f2a095ced6fc5cf64b765685a4d978bd260e4279274a0402b7ca6480777df07d095cd883b53bd269d70e2333464e5897
7
- data.tar.gz: 32860b61ca5ebf164f81e4209b8c66bc8ea243bd48793d75eb0f8f6fc6ff87b09477cb76810a4f1b15f19efc7827ad78fb639ffbe2db8854464c8bd01f6a1ccf
6
+ metadata.gz: 2e2b16bb8de650a087f79498a57f74ccdf1c6a881be820de74eec8cc7a361b7ab4a7df7de77e8e427d8c507d9768dc68381d820a8ba2f3fcfd7ec0c3f5db9fae
7
+ data.tar.gz: 65c30d860c41290b76038f0f76aec79a3ec3e67d8070f709fa354d76057967234c6a19e222d6bf89dba633075c9bdc74a2e088b01723318020a49cbefb50eeb6
@@ -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
- return %r/#{$1}_end$/ !~ stop
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
- return %r/^r#{$1}$/ !~ stop
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
@@ -24,4 +24,4 @@
24
24
  # SOFTWARE.
25
25
  ;
26
26
 
27
- XMP2Assert::VERSION = 3
27
+ XMP2Assert::VERSION = 4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmp2assert
3
3
  version: !ruby/object:Gem::Version
4
- version: '3'
4
+ version: '4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Urabe, Shyouhei