lineparser 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bdea8822388ddba9652deae82f6710ab030c9735
4
- data.tar.gz: 9218d07cff42e46a5e85533fecfadb738ce5ff5f
3
+ metadata.gz: fb48f3617f69e4b3d93dc16d98e61e1bdfa3ca24
4
+ data.tar.gz: c907b97a9d725b94c2594fc6ab95a819a301f355
5
5
  SHA512:
6
- metadata.gz: 3ad5217a907f9e68af04f4fba5dccec5b279dc5440f00deb146165701fcb68722adf3ca35719a91e972e16c3e0457165b39cec4ed36b59c69d74120310bbc764
7
- data.tar.gz: cfbee8de0b26d2939e0c0e6492d120917609cb6116f1a3143bf1681f74a5710d2d6ce2b0c1ca0fdd7f418929adaeff1cf2e94c2617a4b85cc3673e4947848bc8
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; '(\\w+)'}}/)
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.first, params, x, children]
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.first, params, x, children]
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
- [:root, {":resources"=>"posts"}, ["resources: posts"], nil],
127
- [:all, {:captures=>[]}, ["# winning"], nil],
128
- [:all, {:captures=>[]}, ["#"], nil],
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
@@ -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
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file