code-ruby-parser 0.1.1 → 0.1.2
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
- data/CHANGELOG.md +4 -0
- data/bin/push +16 -0
- data/lib/code/parser/call.rb +4 -4
- data/lib/code/parser/function.rb +2 -2
- data/lib/code/parser/identifier.rb +12 -26
- data/lib/code/parser/operation.rb +28 -18
- data/lib/template/parser.rb +1 -1
- metadata +2 -3
- data/code-ruby-parser-0.1.0.gem +0 -0
- data/template-ruby-parser-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0b771db0340e7e46f375f056056480d1b92ec6210fae8aa91025b3b10cdccad
|
4
|
+
data.tar.gz: 71fff0149a4e017fc03e0b4b9798d23fb94c874c937f51b8ee89a3c752619cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6480f03895aa2958809b4d7cf849b2720de2d8eba33af43e2999db8d6609cb83936a4649e931da459dd376c489f9c8d4f0671cdb56a6a45706c931adc0fd9cff
|
7
|
+
data.tar.gz: 3a51ac65786932de2ed2bd1c64f022e7a498e78233aea3085ffb6acd4f26970bcfb7ef3520078c7a94bdc7bf7f2c6e7d4d72a95155cac6e3b2c9d3ba9d84a6a8
|
data/CHANGELOG.md
CHANGED
data/bin/push
ADDED
data/lib/code/parser/call.rb
CHANGED
@@ -38,7 +38,7 @@ class Code
|
|
38
38
|
|
39
39
|
{
|
40
40
|
call: {
|
41
|
-
|
41
|
+
identifier: identifier,
|
42
42
|
arguments: arguments,
|
43
43
|
block: block,
|
44
44
|
comments: comments
|
@@ -117,7 +117,7 @@ class Code
|
|
117
117
|
comments_after: comments_after,
|
118
118
|
default: default,
|
119
119
|
keyword: true,
|
120
|
-
|
120
|
+
identifier: key
|
121
121
|
}.compact
|
122
122
|
else
|
123
123
|
@cursor = previous_cursor
|
@@ -140,13 +140,13 @@ class Code
|
|
140
140
|
comments_before: comments_before,
|
141
141
|
comments_after: comments_after,
|
142
142
|
default: default,
|
143
|
-
|
143
|
+
identifier: identifier
|
144
144
|
}.compact
|
145
145
|
else
|
146
146
|
{
|
147
147
|
comments_before: comments_before,
|
148
148
|
comments_after: comments_after,
|
149
|
-
|
149
|
+
identifier: identifier
|
150
150
|
}.compact
|
151
151
|
end
|
152
152
|
else
|
data/lib/code/parser/function.rb
CHANGED
@@ -68,7 +68,7 @@ class Code
|
|
68
68
|
keyword: true,
|
69
69
|
comments_before: comments_before,
|
70
70
|
comments_after: comments_after,
|
71
|
-
|
71
|
+
identifier: key
|
72
72
|
}.compact
|
73
73
|
else
|
74
74
|
@cursor = previous_cursor
|
@@ -96,7 +96,7 @@ class Code
|
|
96
96
|
default: default,
|
97
97
|
comments_before: comments_before,
|
98
98
|
comments_after: comments_after,
|
99
|
-
|
99
|
+
identifier: identifier
|
100
100
|
}.compact
|
101
101
|
else
|
102
102
|
@cursor = previous_cursor
|
@@ -9,36 +9,22 @@ class Code
|
|
9
9
|
def parse
|
10
10
|
return if end_of_input?
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
elsif !simple && match(ASTERISK
|
17
|
-
|
18
|
-
elsif !
|
19
|
-
|
20
|
-
elsif !next?(SPECIAL)
|
21
|
-
kind = nil
|
22
|
-
else
|
23
|
-
@cursor = previous_cursor
|
24
|
-
buffer!
|
25
|
-
return
|
26
|
-
end
|
27
|
-
|
28
|
-
buffer!
|
12
|
+
if !simple? && match(AMPERSAND)
|
13
|
+
{ block: parse_subclass(::Code::Parser::Statement) }
|
14
|
+
elsif !simple && match(ASTERISK + ASTERISK)
|
15
|
+
{ keyword_splat: parse_subclass(::Code::Parser::Statement) }
|
16
|
+
elsif !simple? && match(ASTERISK)
|
17
|
+
{ regular_splat: parse_subclass(::Code::Parser::Statement) }
|
18
|
+
elsif !next?(SPECIAL) && !next?(KEYWORDS)
|
19
|
+
consume while !next?(SPECIAL) && !end_of_input?
|
29
20
|
|
30
|
-
|
21
|
+
match(QUESTION_MARK) || match(EXCLAMATION_POINT) if !simple?
|
31
22
|
|
32
|
-
|
23
|
+
name = buffer!
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
if KEYWORDS.include?(name)
|
37
|
-
@cursor = previous_cursor
|
38
|
-
buffer!
|
39
|
-
return
|
25
|
+
{ name: name }
|
40
26
|
else
|
41
|
-
|
27
|
+
return
|
42
28
|
end
|
43
29
|
end
|
44
30
|
|
@@ -11,28 +11,38 @@ class Code
|
|
11
11
|
def parse
|
12
12
|
previous_cursor = cursor
|
13
13
|
left = parse_subclass(subclass)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
while operator = match(operators)
|
14
|
+
if left
|
15
|
+
right = []
|
16
|
+
previous_cursor = cursor
|
19
17
|
comments = parse_comments
|
20
|
-
statement = parse_subclass(subclass)
|
21
|
-
right << {
|
22
|
-
comments: comments,
|
23
|
-
statement: statement,
|
24
|
-
operator: operator
|
25
|
-
}.compact
|
26
|
-
end
|
27
18
|
|
28
|
-
|
19
|
+
while operator = match(operators)
|
20
|
+
comments = parse_comments
|
21
|
+
statement = parse_subclass(subclass)
|
22
|
+
right << {
|
23
|
+
comments: comments,
|
24
|
+
statement: statement,
|
25
|
+
operator: operator
|
26
|
+
}.compact
|
27
|
+
end
|
28
|
+
|
29
|
+
if right.empty?
|
30
|
+
@cursor = previous_cursor
|
31
|
+
buffer!
|
32
|
+
left
|
33
|
+
else
|
34
|
+
{
|
35
|
+
operation: {
|
36
|
+
left: left,
|
37
|
+
comments: comments,
|
38
|
+
right: right
|
39
|
+
}.compact
|
40
|
+
}
|
41
|
+
end
|
42
|
+
else
|
29
43
|
@cursor = previous_cursor
|
30
44
|
buffer!
|
31
|
-
|
32
|
-
else
|
33
|
-
{
|
34
|
-
operation: { left: left, comments: comments, right: right }.compact
|
35
|
-
}
|
45
|
+
return
|
36
46
|
end
|
37
47
|
end
|
38
48
|
|
data/lib/template/parser.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code-ruby-parser
|
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
|
- Dorian Marié
|
@@ -23,8 +23,8 @@ files:
|
|
23
23
|
- Gemfile.lock
|
24
24
|
- bin/code-parser
|
25
25
|
- bin/format
|
26
|
+
- bin/push
|
26
27
|
- bin/template-parser
|
27
|
-
- code-ruby-parser-0.1.0.gem
|
28
28
|
- code-ruby-parser.gemspec
|
29
29
|
- docs/class.code
|
30
30
|
- docs/meetup.code
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- spec/code/parser/while_spec.rb
|
113
113
|
- spec/spec_helper.rb
|
114
114
|
- spec/template/parser_spec.rb
|
115
|
-
- template-ruby-parser-0.1.0.gem
|
116
115
|
- template-ruby-parser.gemspec
|
117
116
|
homepage: https://github.com/dorianmariefr/template-ruby-parser
|
118
117
|
licenses:
|
data/code-ruby-parser-0.1.0.gem
DELETED
Binary file
|
Binary file
|