rexle-xpath-parser 0.1.11 → 0.1.12
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
- checksums.yaml.gz.sig +0 -0
- data/lib/rexle-xpath-parser.rb +18 -8
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b754ed1c9cd12d73362a3f1486e6ad1d228f2d16
|
4
|
+
data.tar.gz: 4455f9652ebe23bae65dcf8515c577095033d2a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f157bccb8348d5ee953bc8596ecf2db0024c152c2db78a5e1fee332b30993b1178b1578e70b9a705303af39e9afeab4ea9aa39ddae4d2fdb183141b4e302662
|
7
|
+
data.tar.gz: 5ed1d4c69105cd72f257d4e470f1bb2895262afebe8f49b4fd55d565a1e8663bb8869cd4d0c83e6937a326ba3083cc5ab673ed12e27e3bccce64488e7eae12a2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rexle-xpath-parser.rb
CHANGED
@@ -28,8 +28,12 @@ class RexleXPathParser
|
|
28
28
|
|
29
29
|
#puts 'x: ' + x.inspect
|
30
30
|
|
31
|
-
|
32
|
-
|
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
|
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
|
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.
|
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-
|
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
|