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 +4 -4
- checksums.yaml.gz.sig +3 -2
- data.tar.gz.sig +0 -0
- data/lib/rbparser.rb +47 -4
- metadata +18 -18
- 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: 263860c75437a30130644c81e333bdff117e8b17
|
4
|
+
data.tar.gz: 85b97fcb1353cbc0d9c83631d63cd61094a37236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83924e78016afef0e4c03be66af246b067774d7d5aa530a127c4f015e8ca1ce6fbfc8c9df2f298e3306ac40e9667150bd7f128d03d744aef4a085a75ca2af8e2
|
7
|
+
data.tar.gz: b626f6895290045c521b0fe69940028e16b90572f04c5627e5d3742afb56bda65d56bedf30818b68c5db580b235d38762327772d0dc522ede13e3ea185af9ce5
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
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
|
data/lib/rbparser.rb
CHANGED
@@ -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
|
-
|
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.
|
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
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE2MDkwNDA2MzEwNVoXDTE3MDkwNDA2MzEwNVowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
ggEBANWYQJsB6sxKdJhmYCPlA99xCOxQujC1sRIMkHpZMo4et5xsGm3raEdFEscQ
|
19
|
+
TYdkvbuSDY4X+ua7KkPW1I7kl4TCspgUacqX70gVV9bnArtpIw+zuUjXMimOSKQ8
|
20
|
+
4gbTgsXnaeMrivvlgetJWA3AWfjLmNCZx2MpzNsDyV73qFc/bIGa/cZvlqUkIaNR
|
21
|
+
Cb1qZt7nPBfyLEQRl0kSqOcUXDW853eT0sKkanMJG7iBDiCYLMY6VZ2//cReZagT
|
22
|
+
a4cdYuHKdUW1ggpqkpuZBzaupDKYv59lAqTAHrma1xH0caazuXx7djvlizhI3Uya
|
23
|
+
RNyTS/gXuZoxSEuY6NNNAYuVdjcCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUSddRi2IzNXmGO0X4o2NTBRxOGaUwJgYDVR0RBB8w
|
25
25
|
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAHn++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:
|
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.
|
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
|