rexle-xpath-parser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/rexle-xpath-parser.rb +37 -0
- data.tar.gz.sig +3 -0
- metadata +67 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 696f378210d7800f7d4c79a48d6b9b12bd641209
|
4
|
+
data.tar.gz: 3118e004676a3976c4685338c469eff34c347748
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b3611aa3dfe406a757bdb5b14c6f5bd47dc9ab14987c4695a6ac03d0ad03c31a35d43f7e3886b26c8e31caf3fd013bb8b521323064752b81a3dc6835106d7cb
|
7
|
+
data.tar.gz: 9ae85c002bee277546550dcf84520ccbf168282b85e9a087417755bcfbbbb1d0302499309736031bafa623b0372793cc968cfb216599f60b004f79b6007e51fc
|
checksums.yaml.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: rexle-xpath-parser.rb
|
4
|
+
|
5
|
+
|
6
|
+
class RexleXPathParser
|
7
|
+
|
8
|
+
attr_reader :to_a
|
9
|
+
|
10
|
+
def initialize(s)
|
11
|
+
@to_a = scan(s.clone)
|
12
|
+
end
|
13
|
+
|
14
|
+
def scan(s2)
|
15
|
+
|
16
|
+
if s2.lstrip[0] == '|' then
|
17
|
+
return [s2.slice!(/\s*\|\s*/).strip]
|
18
|
+
end
|
19
|
+
|
20
|
+
s1 = s2.slice!(/\w+[\(\[]/)
|
21
|
+
|
22
|
+
if s1[-1] == '[' then
|
23
|
+
s1 << s2.slice!(/[^\]]+\]|\]/)
|
24
|
+
return [s1]
|
25
|
+
end
|
26
|
+
|
27
|
+
if s2[/\w+[\(\[]/] then
|
28
|
+
r = [scan(s2)]
|
29
|
+
r << scan(s2) while s2[/\w+[\(\[]/]
|
30
|
+
s3 = s2
|
31
|
+
else
|
32
|
+
s1 << s2.slice!(/[^\)\]]+[\)\]]|[\)\]]/)
|
33
|
+
end
|
34
|
+
|
35
|
+
[s1,r,s3].compact
|
36
|
+
end
|
37
|
+
end
|
data.tar.gz.sig
ADDED
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rexle-xpath-parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE1MDUyOTIwMzkzOFoXDTE2MDUyODIwMzkzOFowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBALsORT32wo5h6pPaRIzRX1ci1+6MqtyZKEQtjoHqC8VqKIWz1e2asDWfblsb
|
19
|
+
rrR+dWbx93wAenlNrA/2SeZZYyX60Kd53nrDg8V6R53dXscjPhXMP61r1Af0B//N
|
20
|
+
EarqaV1ftkuA4YFQI3v8zpAqaLSxsqb80JGeVt/9+hLctmnBpg12mEEECIOVfUjl
|
21
|
+
6BAjpT0xAao8lOJGpN1D/OH5nQU3/f5IOBmwBcJjs1vB4PT7yZnB2lYcSvLzaSpJ
|
22
|
+
r1PLLLSR/Ha/RFs1353BU9JuSavnvQrW4tyJgh20dVtGJE8CY1KgwX3diTqlH/ct
|
23
|
+
X+ySK2oRqgadB8o3YyDT2rB9jR0CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUU2b3SAuNaDfReHTyaKlwRNpRANcwJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAlxp+b9iY
|
27
|
+
yadeuYVXLipJFcxEwur46s3H2sgvLBgiYSS/hNM9TJNy22AhuTiBMDG9Vfl8Q2pp
|
28
|
+
JJRFwnxMVI/t7CUHf+/wHKszoKP7HvFeeyhH/nbjWI5CCknbEiPnLv8emOXUg7gR
|
29
|
+
t/KTNjV7IwKJ5WXGO/OZOzIUDsxARY4eiieFObcGv3+ISrYBDTtZcM3U+UZcZCri
|
30
|
+
ZW1eKo87zpxPFRkhjOE73S2i7sVEk1fwlldgRwHxet0DdLD0eemnyvjooaLqMul1
|
31
|
+
adFNS7+S3VVpQqBQ7hIMoNW5ldGHINll6Z0dbjsCO8OFGOkrnzt9ovLffOXuQHpT
|
32
|
+
Gpk2If0KQMuV2Q==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
35
|
+
dependencies: []
|
36
|
+
description:
|
37
|
+
email: james@r0bertson.co.uk
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- lib/rexle-xpath-parser.rb
|
43
|
+
homepage: https://github.com/jrobertson/rexle-xpath-parser
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.4.6
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: rexle-xpath-parser
|
67
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|