lineparser 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.tar.gz.sig +0 -0
- data/lib/lineparser.rb +21 -4
- 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: 5b17ab2c8546919d2a3eedeedb5ab9a90a07fdae
|
4
|
+
data.tar.gz: 1169df54ee693a8a7b8025cff77b2d4cb7fa42cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c094653ed8f021cc12ac859dcb663f41067db4b6afd75a802259de0a15489b551ad84b381624c1c226f499bd2d5c130c24b0a18f559ab463ee0cbe2f5111b477
|
7
|
+
data.tar.gz: 5ac836e962ff35aec46538f51115875df085c10467304564e971ab48204748ca46270d72b20c085c96f257e46e6dc6ac0135b132b092f834a6f3395a39265e3f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/lineparser.rb
CHANGED
@@ -70,12 +70,14 @@ class LineParser
|
|
70
70
|
|
71
71
|
def scan(xpatterns, items)
|
72
72
|
|
73
|
+
puts 'xpatterns : ' + xpatterns.inspect
|
73
74
|
records = []
|
74
75
|
|
75
76
|
while items.any? do
|
76
77
|
|
77
78
|
x = items.shift
|
78
|
-
|
79
|
+
puts 'x : ' + x.inspect
|
80
|
+
params, context = nil, nil
|
79
81
|
|
80
82
|
xpatterns = [xpatterns] unless xpatterns[0].is_a? Array
|
81
83
|
|
@@ -84,19 +86,34 @@ class LineParser
|
|
84
86
|
end
|
85
87
|
|
86
88
|
if found then
|
89
|
+
|
87
90
|
children = nil
|
88
91
|
children = scan(found.last, x[1..-1]) if found.last.is_a? Array
|
89
92
|
records << [found[2], params, x, children]
|
93
|
+
|
90
94
|
else
|
91
95
|
|
92
|
-
found = xpatterns.detect do |_, pattern|
|
93
|
-
|
96
|
+
found = xpatterns.detect do |_, pattern, id|
|
97
|
+
|
98
|
+
if pattern == :root then
|
99
|
+
|
100
|
+
found = @tree_patterns.detect do |_, pattern2, id|
|
101
|
+
params = @h[pattern2.class.to_s.to_sym].call x.first, pattern2
|
102
|
+
context = id if params
|
103
|
+
end
|
104
|
+
|
105
|
+
else
|
106
|
+
|
107
|
+
params = @h[pattern.class.to_s.to_sym].call x.first, pattern
|
108
|
+
context = id if params
|
109
|
+
end
|
94
110
|
end
|
95
111
|
|
96
112
|
if found then
|
113
|
+
|
97
114
|
children = nil
|
98
115
|
children = scan(found[3..-1], x[1..-1]) if found.last.is_a? Array
|
99
|
-
records << [
|
116
|
+
records << [context, params, x, children]
|
100
117
|
end
|
101
118
|
end
|
102
119
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lineparser
|
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
|
91WD0+jYVX++HpUKNCp85+avduv17ztFqGGok26cpRFYNdIIFFu8T4cl2jsqGI2l
|
32
32
|
hT3uS3yIJ12YEQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-03-
|
34
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|