rexle-xpath-parser 0.1.11 → 0.1.12

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: 0db466429d95d0cf12789e04b3164973288b90da
4
- data.tar.gz: 526c10f5d24d275b7567e291455bc19d41ab569c
3
+ metadata.gz: b754ed1c9cd12d73362a3f1486e6ad1d228f2d16
4
+ data.tar.gz: 4455f9652ebe23bae65dcf8515c577095033d2a8
5
5
  SHA512:
6
- metadata.gz: 417e4876e41c02a27d78a818ca6557dd8ed3d806700d96c11d996fc38bdec6812d4572b26f214163bcaef70a1c86d792291e160fee12f796845c5b2c429df8ca
7
- data.tar.gz: 7ab7635ba885d2ba9fe9096d10fe1790944e7da6d0cb6c9b5bd92d9d026427e6f9fe91646d8c468086cd5b182ee0c38b0e54b3e5007db4b86817ec49aa7251aa
6
+ metadata.gz: 8f157bccb8348d5ee953bc8596ecf2db0024c152c2db78a5e1fee332b30993b1178b1578e70b9a705303af39e9afeab4ea9aa39ddae4d2fdb183141b4e302662
7
+ data.tar.gz: 5ed1d4c69105cd72f257d4e470f1bb2895262afebe8f49b4fd55d565a1e8663bb8869cd4d0c83e6937a326ba3083cc5ab673ed12e27e3bccce64488e7eae12a2
checksums.yaml.gz.sig CHANGED
Binary file
@@ -28,8 +28,12 @@ class RexleXPathParser
28
28
 
29
29
  #puts 'x: ' + x.inspect
30
30
 
31
- if x =~ /^@[\w\/]+/ then
32
- r << [[:attribute, x[/@(\w+)/,1]]]
31
+ return r << functionalise(x) if x.is_a? Array
32
+
33
+ if /^(?<func>\w+)\(\)/ then
34
+ r << func.to_sym
35
+ elsif /^@(?<attribute>[\w\/]+)/ =~ x
36
+ r << [[:attribute, attribute]]
33
37
  elsif x =~ /^\/\//
34
38
  r << [:recursive, *RexleXPathParser.new(x[2..-1]).to_a]
35
39
  elsif x =~ /[\w\/]+\[/
@@ -54,8 +58,6 @@ class RexleXPathParser
54
58
  r << [x.chop.to_sym]
55
59
  elsif x =~ /\d+/
56
60
  r << [:index, x]
57
- elsif x.is_a? Array
58
- r << functionalise(x)
59
61
  elsif /^attribute::(?<attribute>\w+)/ =~ x
60
62
  r << [:attribute, attribute]
61
63
  elsif x =~ /[\w\/]+/
@@ -122,7 +124,9 @@ class RexleXPathParser
122
124
  a = []
123
125
 
124
126
  # e.g. position()
125
- if s =~ /^\w+\(/ then
127
+ if /^\w+\(\)$/ =~ s then
128
+ a << s
129
+ elsif s =~ /^\w+\(/
126
130
 
127
131
  found, token, remainder = lmatch(s.chars, '(',')')
128
132
 
@@ -148,12 +152,14 @@ class RexleXPathParser
148
152
  remainder = s
149
153
  end
150
154
 
155
+ return a if remainder.nil? or remainder.empty?
156
+
151
157
  operator = remainder.slice!(/^\s*\|\s*/)
152
158
 
153
159
  if operator then
154
160
  a.concat [operator, *match(remainder)]
155
161
  else
156
- a << remainder if remainder.length > 0
162
+ a << remainder
157
163
  end
158
164
 
159
165
  a
@@ -165,19 +171,23 @@ class RexleXPathParser
165
171
  def scan(s)
166
172
 
167
173
  if s =~ /^\w+\(/ then
174
+
168
175
  func = s.slice!(/\w+\(/)
169
176
  remainder = s[0..-2]
177
+
178
+ return func if remainder.empty?
179
+
170
180
  if remainder =~ /^\w+\(/ then
171
181
  scan(remainder)
172
182
  else
173
183
  [func, match(remainder)]
174
184
  end
185
+
175
186
  else
176
187
  s
177
188
  end
178
189
  end
179
190
 
180
191
  alias tokenise match
181
-
182
-
192
+
183
193
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle-xpath-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  adFNS7+S3VVpQqBQ7hIMoNW5ldGHINll6Z0dbjsCO8OFGOkrnzt9ovLffOXuQHpT
32
32
  Gpk2If0KQMuV2Q==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-05-24 00:00:00.000000000 Z
34
+ date: 2016-05-25 00:00:00.000000000 Z
35
35
  dependencies: []
36
36
  description:
37
37
  email: james@r0bertson.co.uk
metadata.gz.sig CHANGED
Binary file