lineparser 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/lineparser.rb +8 -24
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: fb48f3617f69e4b3d93dc16d98e61e1bdfa3ca24
|
4
|
+
data.tar.gz: c907b97a9d725b94c2594fc6ab95a819a301f355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd40a63253435f1c219c394d02745d7cffa2fa814913f97ad8204f6c6c3afe5c0bb4d70204d09de0676184da09abb8b0cfe1ad080ca85a272d24428830cfc2d3
|
7
|
+
data.tar.gz: e2db55c194a8349b9e9d2a137eabf9226f024b0c7c8510d399b5503b81635c6cdca57f759f0bd71f78702d7402022179864fa349b6c0e807e0e2158c1ec129af
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/lineparser.rb
CHANGED
@@ -16,7 +16,7 @@ class LineParser
|
|
16
16
|
labels = []
|
17
17
|
|
18
18
|
pattern.gsub!('+',"\\\\+")
|
19
|
-
r = s.match(/#{pattern.gsub(/:\w+/) {|x| labels << x; '(\\
|
19
|
+
r = s.match(/#{pattern.gsub(/:\w+/) {|x| labels << x; '(\\S+)'}}/)
|
20
20
|
|
21
21
|
if r then
|
22
22
|
params = Hash[*labels.zip(r.captures).flatten(1)]
|
@@ -70,7 +70,7 @@ class LineParser
|
|
70
70
|
if found then
|
71
71
|
children = nil
|
72
72
|
children = scan(found.last, x[1..-1]) if found.last.is_a? Array
|
73
|
-
records << [found
|
73
|
+
records << [found[2], params, x, children]
|
74
74
|
else
|
75
75
|
|
76
76
|
found = xpatterns.detect do |_, pattern|
|
@@ -80,7 +80,7 @@ class LineParser
|
|
80
80
|
if found then
|
81
81
|
children = nil
|
82
82
|
children = scan(found[3..-1], x[1..-1]) if found.last.is_a? Array
|
83
|
-
records << [found
|
83
|
+
records << [found[2], params, x, children]
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -116,30 +116,14 @@ patterns = [
|
|
116
116
|
[:resource, 'model', :model],
|
117
117
|
[:model, ':class_name', :model_class],
|
118
118
|
[:model_class, /orange (\w+)/, :model_class_attribute],
|
119
|
-
[:all,
|
119
|
+
[:all, /#/, :comment]
|
120
120
|
]
|
121
121
|
|
122
122
|
lp = LineParser.new patterns
|
123
123
|
r = lp.parse lines
|
124
124
|
#=>
|
125
|
-
[
|
126
|
-
[:
|
127
|
-
[:
|
128
|
-
[:
|
129
|
-
[:root, {":resource"=>"post"}, ["post", ["model", ["Post", ["orange 123"], ["fff"]]]],
|
130
|
-
[[:resource, {}, ["model", ["Post", ["orange 123"], ["fff"]]],
|
131
|
-
[[:model, {":class_name"=>"Post"}, ["Post", ["orange 123"], ["fff"]],
|
132
|
-
[[:model_class, {:captures=>["123"]}, ["orange 123"], nil]]
|
133
|
-
]]
|
134
|
-
]]
|
135
|
-
],
|
136
|
-
[:root, {":resource"=>"comments"}, ["comments", ["model", ["Comment", ["orange 576"], ["ggg"]]]],
|
137
|
-
[[:resource, {}, ["model", ["Comment", ["orange 576"], ["ggg"]]],
|
138
|
-
[[:model, {":class_name"=>"Comment"}, ["Comment", ["orange 576"], ["ggg"]],
|
139
|
-
[[:model_class, {:captures=>["576"]}, ["orange 576"], nil]]
|
140
|
-
]]
|
141
|
-
]]
|
142
|
-
]
|
143
|
-
]
|
144
|
-
|
125
|
+
=> [
|
126
|
+
[:app_path, {":app_path"=>"/tmp"}, ["app_path: /tmp"], nil],
|
127
|
+
[:app, {":app"=>"blog"}, ["app: blog"], nil],
|
128
|
+
[:resources, {":resources"=>"posts"}, ["resources: posts"], ...
|
145
129
|
=end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|