rbparser 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62c5342904643f85611348d75c6ded114b5b42bc
4
- data.tar.gz: ea6cecdaf0f0f028ec06b03b2d58d59b863f8cf4
3
+ metadata.gz: 263860c75437a30130644c81e333bdff117e8b17
4
+ data.tar.gz: 85b97fcb1353cbc0d9c83631d63cd61094a37236
5
5
  SHA512:
6
- metadata.gz: 01522e3b37745e2af39a4506a20783549b06c48a4e8bdb195a727b16b3b38cca809907a9f5da34239732bb491c355fd50cdcf757445ecde3f7fe76111a2b7099
7
- data.tar.gz: 0090320f56e230f08329433bbf2d37ce89c166134403286b85e3f8bd35b68bfddee733b8ce47dbe3baf6123d422339aed59b7eca361d1a698b41716f104ee427
6
+ metadata.gz: 83924e78016afef0e4c03be66af246b067774d7d5aa530a127c4f015e8ca1ce6fbfc8c9df2f298e3306ac40e9667150bd7f128d03d744aef4a085a75ca2af8e2
7
+ data.tar.gz: b626f6895290045c521b0fe69940028e16b90572f04c5627e5d3742afb56bda65d56bedf30818b68c5db580b235d38762327772d0dc522ede13e3ea185af9ce5
@@ -1,2 +1,3 @@
1
-
2
- �O�O'|]�Ml�b�p��=��w%�}�&o�zC��X��׳"#�3B���M�H���9�[2�W�������[܃�0cXZ����P�Pɣ��g�8��76�J�� F
1
+ 'pI��\~QX�U'2����?o�6 _+G{���Wٙ�$���*��*�u^� �}ߠa5�|�:�Gg��\��T���4`L�7~�����j6zx�^D��A��غ�B�{���P��*�c"3;x���r\�qZ���,����
2
+ �Ƽ�98@�0=~�����˃��'k2��q��e �1
3
+ �Rل,3zq��p-Øz�徖����]��M���ۋ��]���/�j٤t�U Ҕ�^b�k8''� s
data.tar.gz.sig CHANGED
Binary file
@@ -22,6 +22,10 @@ class RbParser
22
22
  private
23
23
 
24
24
  def expressions(params)
25
+
26
+ parse /#(.*)/ do |comment|
27
+ [:comment, comment]
28
+ end
25
29
 
26
30
  parse /if (.*) then/ do |condtn|
27
31
  [:if, condtn]
@@ -41,10 +45,33 @@ class RbParser
41
45
  r
42
46
  end
43
47
 
44
- get /(\w+)\(([^\)]+)\)/ do |mthdnme, argslst|
48
+ parse /(\w+)\(([^\)]+)\)/ do |mthdnme, argslst|
45
49
  [:method, mthdnme, argslst]
46
50
  end
51
+
52
+ parse /case\s+(\w+)/ do |arg|
53
+ [:case, arg]
54
+ end
55
+
56
+ parse /when\s+(.*)/ do |expression|
57
+ [:when, expression]
58
+ end
59
+
60
+ parse /else/ do
61
+ [:else]
62
+ end
63
+
64
+ parse /elsif\s+(.*)/ do |cndtn|
65
+ [:elsif, cndtn]
66
+ end
47
67
 
68
+ parse /(\w+)\s+([^\)]+)\s+/ do |mthdnme, argslst|
69
+ [:method, mthdnme, argslst]
70
+ end
71
+
72
+ parse /.*/ do
73
+ [:blankline]
74
+ end
48
75
  end
49
76
 
50
77
  alias parse get
@@ -54,11 +81,11 @@ class RbParser
54
81
  def scan_lines(s)
55
82
 
56
83
  a = s.lines.inject([]) do |r,line|
57
-
58
- line.strip.length > 0 ? r << scan_line(line) : r
84
+ #puts 'line: ' + line.inspect
85
+ line.strip.length > 0 ? r << scan_line(line) : r << [:blankline]
59
86
 
60
87
  end
61
-
88
+ #puts 'a: ' + a.inspect
62
89
  treeize a
63
90
  end
64
91
 
@@ -83,6 +110,17 @@ class RbParser
83
110
  r << [:def, name.to_sym, args]
84
111
  r.last.concat treeize(a)
85
112
 
113
+ when :case
114
+
115
+ expr = remaining.first
116
+ r << [:case, expr]
117
+ r.last.concat treeize(a)
118
+
119
+ when :when
120
+
121
+ expr = remaining.first
122
+ r << [:when, expr]
123
+
86
124
  when :method
87
125
 
88
126
  name, *args = remaining
@@ -91,6 +129,11 @@ class RbParser
91
129
  when :end
92
130
 
93
131
  return r
132
+
133
+ when :comment
134
+ r << [:comment, remaining.join]
135
+
136
+ when :blankline then r << [:blankline]
94
137
 
95
138
  end
96
139
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -12,26 +12,26 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
14
  YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE1MDcwNTEwMjkxOVoXDTE2MDcwNDEwMjkxOVowSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE2MDkwNDA2MzEwNVoXDTE3MDkwNDA2MzEwNVowSDESMBAG
16
16
  A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
17
  EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBANQ/D7/+jfxhNVxEOQqTLTlcvv9a73KZR7Ukg4u/jqgiWJpzzM/XphXW3OGq
19
- t0PrAoLZ5vaPpExUX5dUv009af5OmPdxcD4h97oKRgB5ZQsdVRgZf+v1gCDBAMuk
20
- uxYBf92Fz/L9BfA0dFRMmw3oWucAxbUCGcwW3IJbH6gKpAvB+aUjvBamCc0mWumN
21
- aZ7WkgKF+p709VQYaivX1mtIZtw4QSeqQ7fzItrLS9t0nTx0XbhaPi8VxfyX/S4w
22
- KhBgxh5xnAzu3tDFkzRmgvpLaXBAi9NXykejk7fnJdDcDo3zAhM7koyWQCbaXL2o
23
- A+r2ycMQlow/5P7KfO5ZrWH+ebcCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
- DwQEAwIEsDAdBgNVHQ4EFgQUpVqaw4OzkMnYucZ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Hn++Y0KS
27
+ osr6J3QmDtwrTouyQkNb+aKKnC7Y3JWh+nbR5qIJs5EIYq+PhCDglgYW75dUrrWE
28
+ 2OxjtnYn0q3rfsJQrRLZg3xcnr6vI1HcinL/DIxM4Kq3o3uVpDHSvvQ7dEmIZM/v
29
+ kiPHmF1K9yjcN9laJvS6uR5P90rxLnCKPx8SQTNN1aIVhuF0S0eQRoVRVjHTjUqU
30
+ jpONgsgsfGP1UnHk4Pg7fbJu9b3IERA3f8lgghpNO/yxxrotm6DY7AATTZfzuKZX
31
+ cNHKf6L55p/Z4EjEJgMWRfFR0Df1hujpHWe1ZMV5R09ScS+HgkBRurvS+l5j4XzZ
32
+ 3n9MJMrWEnooTw==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-07-05 00:00:00.000000000 Z
34
+ date: 2016-09-04 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: app-routes
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.4.6
83
+ rubygems_version: 2.5.1
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Experimental gem to parse Ruby code
metadata.gz.sig CHANGED
Binary file