template-ruby-parser 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/docs/precedence.code +1 -0
- data/docs/precedence.template +35 -0
- data/lib/code/parser/and_operator.rb +1 -1
- data/lib/code/parser/call.rb +33 -24
- data/lib/code/parser/chained_call.rb +3 -3
- data/lib/code/parser/class.rb +2 -3
- data/lib/code/parser/dictionnary.rb +13 -9
- data/lib/code/parser/equal.rb +1 -2
- data/lib/code/parser/equality.rb +1 -1
- data/lib/code/parser/function.rb +20 -11
- data/lib/code/parser/name.rb +14 -0
- data/lib/code/parser/negation.rb +1 -1
- data/lib/code/parser/operation.rb +15 -6
- data/lib/code/parser/or_operator.rb +1 -1
- data/lib/code/parser/power.rb +3 -3
- data/lib/code/parser/splat.rb +35 -0
- data/lib/template/parser.rb +1 -1
- data/spec/code/parser/addition_spec.rb +1 -1
- data/spec/code/parser/and_operator_spec.rb +1 -1
- data/spec/code/parser/bitwise_and_spec.rb +1 -1
- data/spec/code/parser/bitwise_or_spec.rb +1 -1
- data/spec/code/parser/boolean_spec.rb +1 -1
- data/spec/code/parser/call_spec.rb +1 -1
- data/spec/code/parser/chained_call_spec.rb +1 -1
- data/spec/code/parser/class_spec.rb +1 -1
- data/spec/code/parser/code_spec.rb +1 -1
- data/spec/code/parser/dictionnary_spec.rb +1 -1
- data/spec/code/parser/equal_spec.rb +1 -1
- data/spec/code/parser/equality_spec.rb +1 -1
- data/spec/code/parser/function_spec.rb +1 -1
- data/spec/code/parser/greater_than_spec.rb +1 -1
- data/spec/code/parser/group_spec.rb +1 -1
- data/spec/code/parser/if_modifier_spec.rb +1 -1
- data/spec/code/parser/if_spec.rb +1 -1
- data/spec/code/parser/list_spec.rb +1 -1
- data/spec/code/parser/multiplication_spec.rb +1 -1
- data/spec/code/parser/negation_spec.rb +1 -1
- data/spec/code/parser/not_keyword_spec.rb +1 -1
- data/spec/code/parser/nothing_spec.rb +1 -1
- data/spec/code/parser/number_spec.rb +1 -1
- data/spec/code/parser/or_keyword_spec.rb +1 -1
- data/spec/code/parser/or_operator_spec.rb +1 -1
- data/spec/code/parser/power_spec.rb +1 -1
- data/spec/code/parser/range_spec.rb +1 -1
- data/spec/code/parser/rescue_spec.rb +1 -1
- data/spec/code/parser/shift_spec.rb +1 -1
- data/spec/code/parser/string_spec.rb +1 -1
- data/spec/code/parser/ternary_spec.rb +1 -1
- data/spec/code/parser/unary_minus_spec.rb +1 -1
- data/spec/code/parser/while_spec.rb +1 -1
- data/spec/code/parser_spec.rb +13 -0
- metadata +8 -3
- data/lib/code/parser/identifier.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa0e427ab1d41b51af61ac220b267d00adb4f0f211205584d0db4a216d97d2dc
|
4
|
+
data.tar.gz: b9ac2ad7ec6d595e2a7a81b0ff365739c5be29c35f8c41cfcb22f6f4db8ce7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9b5023531a76db1fab33f19fee80b3d162de2155202fd136d9e56b5c496d6a18904d5ee99be919c192995adfd40ac5b461e11eb972c52af81ca4e832f30f3b0
|
7
|
+
data.tar.gz: e5d2b91823eaa54a7ed3f05e01873306310b579c9fc4852969d9d2aa992d40f545ed637d7569bba4e8aa53d9420c7a5fe05e7a8b60d9cfbd47e8ea8bbd1d17ff
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
- Code
|
2
|
+
- Statement
|
3
|
+
- Class
|
4
|
+
- While
|
5
|
+
- If
|
6
|
+
- IfModifier
|
7
|
+
- OrKeyword
|
8
|
+
- NotKeyword
|
9
|
+
- Equal
|
10
|
+
- Rescue
|
11
|
+
- Ternary
|
12
|
+
- Range
|
13
|
+
- OrOperator
|
14
|
+
- AndOperator
|
15
|
+
- Equality
|
16
|
+
- GreaterThan
|
17
|
+
- BitwiseOr
|
18
|
+
- BitwiseAnd
|
19
|
+
- Shift
|
20
|
+
- Addition
|
21
|
+
- Multiplication
|
22
|
+
- UnaryMinus
|
23
|
+
- Power
|
24
|
+
- Negation
|
25
|
+
- Splat
|
26
|
+
- Function
|
27
|
+
- ChainedCall
|
28
|
+
- Dictionnary
|
29
|
+
- List
|
30
|
+
- String
|
31
|
+
- Number
|
32
|
+
- Boolean
|
33
|
+
- Nothing
|
34
|
+
- Group
|
35
|
+
- Call
|
data/lib/code/parser/call.rb
CHANGED
@@ -2,8 +2,8 @@ class Code
|
|
2
2
|
class Parser
|
3
3
|
class Call < ::Code::Parser
|
4
4
|
def parse
|
5
|
-
|
6
|
-
return unless
|
5
|
+
name = parse_subclass(::Code::Parser::Name)
|
6
|
+
return unless name
|
7
7
|
|
8
8
|
if match(OPENING_PARENTHESIS)
|
9
9
|
arguments = []
|
@@ -38,7 +38,7 @@ class Code
|
|
38
38
|
|
39
39
|
{
|
40
40
|
call: {
|
41
|
-
|
41
|
+
name: name,
|
42
42
|
arguments: arguments,
|
43
43
|
block: block,
|
44
44
|
comments: comments
|
@@ -106,18 +106,18 @@ class Code
|
|
106
106
|
previous_cursor = cursor
|
107
107
|
|
108
108
|
comments_before = parse_comments
|
109
|
-
|
109
|
+
name = parse_subclass(::Code::Parser::Name)
|
110
110
|
comments_after = parse_comments
|
111
111
|
|
112
|
-
if
|
112
|
+
if name && match(COLON) || match(EQUAL + GREATER)
|
113
113
|
default = parse_default
|
114
114
|
|
115
115
|
{
|
116
|
-
|
117
|
-
|
116
|
+
kind: :keyword,
|
117
|
+
name: name,
|
118
118
|
default: default,
|
119
|
-
|
120
|
-
|
119
|
+
comments_before: comments_before,
|
120
|
+
comments_after: comments_after
|
121
121
|
}.compact
|
122
122
|
else
|
123
123
|
@cursor = previous_cursor
|
@@ -129,26 +129,35 @@ class Code
|
|
129
129
|
def parse_regular_parameter
|
130
130
|
previous_cursor = cursor
|
131
131
|
comments_before = parse_comments
|
132
|
-
|
133
|
-
if
|
132
|
+
|
133
|
+
if match(AMPERSAND)
|
134
|
+
kind = :block
|
135
|
+
elsif match(ASTERISK + ASTERISK)
|
136
|
+
kind = :keyword_splat
|
137
|
+
elsif match(ASTERISK)
|
138
|
+
kind = :regular_splat
|
139
|
+
else
|
140
|
+
kind = nil
|
141
|
+
end
|
142
|
+
|
143
|
+
name = parse_subclass(::Code::Parser::Name)
|
144
|
+
|
145
|
+
if name
|
134
146
|
comments_after = parse_comments
|
135
147
|
|
136
148
|
if match(EQUAL)
|
137
149
|
default = parse_default
|
138
|
-
|
139
|
-
{
|
140
|
-
comments_before: comments_before,
|
141
|
-
comments_after: comments_after,
|
142
|
-
default: default,
|
143
|
-
identifier: identifier
|
144
|
-
}.compact
|
145
150
|
else
|
146
|
-
|
147
|
-
comments_before: comments_before,
|
148
|
-
comments_after: comments_after,
|
149
|
-
identifier: identifier
|
150
|
-
}.compact
|
151
|
+
default = nil
|
151
152
|
end
|
153
|
+
|
154
|
+
{
|
155
|
+
comments_before: comments_before,
|
156
|
+
comments_after: comments_after,
|
157
|
+
default: default,
|
158
|
+
name: name,
|
159
|
+
kind: kind
|
160
|
+
}.compact
|
152
161
|
else
|
153
162
|
@cursor = previous_cursor
|
154
163
|
buffer!
|
@@ -162,8 +171,8 @@ class Code
|
|
162
171
|
comments_after = parse_comments
|
163
172
|
|
164
173
|
default = {
|
165
|
-
comments_before: comments_before,
|
166
174
|
statement: statement,
|
175
|
+
comments_before: comments_before,
|
167
176
|
comments_after: comments_after
|
168
177
|
}.compact
|
169
178
|
|
@@ -2,8 +2,8 @@ class Code
|
|
2
2
|
class Parser
|
3
3
|
class ChainedCall < ::Code::Parser
|
4
4
|
def parse
|
5
|
-
previous_cursor = cursor
|
6
5
|
left = parse_dictionnary
|
6
|
+
previous_cursor = cursor
|
7
7
|
comments_before = parse_comments
|
8
8
|
|
9
9
|
if left && match([DOT, COLON + COLON])
|
@@ -24,12 +24,12 @@ class Code
|
|
24
24
|
else
|
25
25
|
@cursor = previous_cursor
|
26
26
|
buffer!
|
27
|
-
|
27
|
+
left
|
28
28
|
end
|
29
29
|
else
|
30
30
|
@cursor = previous_cursor
|
31
31
|
buffer!
|
32
|
-
|
32
|
+
left
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/lib/code/parser/class.rb
CHANGED
@@ -7,7 +7,7 @@ class Code
|
|
7
7
|
if match(CLASS_KEYWORD)
|
8
8
|
first_comments = parse_comments
|
9
9
|
|
10
|
-
name = parse_subclass(::Code::Parser::
|
10
|
+
name = parse_subclass(::Code::Parser::Name)
|
11
11
|
|
12
12
|
if name
|
13
13
|
second_comments = parse_comments
|
@@ -15,8 +15,7 @@ class Code
|
|
15
15
|
if match(LESSER)
|
16
16
|
previous_cursor = cursor
|
17
17
|
third_comments = parse_comments
|
18
|
-
superclass =
|
19
|
-
parse_subclass(::Code::Parser::Identifier, simple: true)
|
18
|
+
superclass = parse_subclass(::Code::Parser::Name)
|
20
19
|
|
21
20
|
if !superclass
|
22
21
|
@cursor = previous_cursor
|
@@ -13,34 +13,38 @@ class Code
|
|
13
13
|
|
14
14
|
match(CLOSING_CURLY_BRACKET)
|
15
15
|
|
16
|
-
{ dictionnary: dictionnary.compact, comments: comments }
|
16
|
+
{ dictionnary: dictionnary.compact, comments: comments }.compact
|
17
17
|
else
|
18
18
|
parse_subclass(::Code::Parser::List)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
def parse_key_value
|
23
|
+
previous_cursor = cursor
|
24
|
+
|
23
25
|
comments_before = parse_comments
|
24
26
|
|
25
27
|
key = parse_subclass(::Code::Parser::Statement)
|
26
28
|
|
27
29
|
comments_after = parse_comments
|
28
30
|
|
29
|
-
|
31
|
+
if key
|
32
|
+
if match(COLON) || match(EQUAL + GREATER)
|
33
|
+
value = parse_code
|
34
|
+
else
|
35
|
+
value = nil
|
36
|
+
end
|
30
37
|
|
31
|
-
if match(COLON) || match(EQUAL + GREATER)
|
32
38
|
{
|
33
39
|
key: key,
|
34
|
-
value:
|
40
|
+
value: value,
|
35
41
|
comments_before: comments_before,
|
36
42
|
comments_after: comments_after
|
37
43
|
}.compact
|
38
44
|
else
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
comments_after: comments_after
|
43
|
-
}.compact
|
45
|
+
@cursor = previous_cursor
|
46
|
+
buffer!
|
47
|
+
return
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
data/lib/code/parser/equal.rb
CHANGED
@@ -9,7 +9,6 @@ class Code
|
|
9
9
|
comments_before = parse_comments
|
10
10
|
|
11
11
|
if operator = match(EQUALS)
|
12
|
-
previous_cursor = cursor
|
13
12
|
comments_after = parse_comments
|
14
13
|
|
15
14
|
right = parse_subclass(::Code::Parser::Equal)
|
@@ -26,7 +25,7 @@ class Code
|
|
26
25
|
else
|
27
26
|
@cursor = previous_cursor
|
28
27
|
buffer!
|
29
|
-
|
28
|
+
left
|
30
29
|
end
|
31
30
|
else
|
32
31
|
@cursor = previous_cursor
|
data/lib/code/parser/equality.rb
CHANGED
data/lib/code/parser/function.rb
CHANGED
@@ -55,20 +55,18 @@ class Code
|
|
55
55
|
previous_cursor = cursor
|
56
56
|
|
57
57
|
comments_before = parse_comments
|
58
|
-
|
59
|
-
key = parse_subclass(::Code::Parser::Identifier)
|
60
|
-
|
58
|
+
name = parse_subclass(::Code::Parser::Name)
|
61
59
|
comments_after = parse_comments
|
62
60
|
|
63
|
-
if
|
61
|
+
if name && (match(COLON) || match(EQUAL + GREATER))
|
64
62
|
default = parse_code
|
65
63
|
|
66
64
|
{
|
65
|
+
kind: :keyword,
|
66
|
+
name: name,
|
67
67
|
default: default,
|
68
|
-
keyword: true,
|
69
68
|
comments_before: comments_before,
|
70
|
-
comments_after: comments_after
|
71
|
-
identifier: key
|
69
|
+
comments_after: comments_after
|
72
70
|
}.compact
|
73
71
|
else
|
74
72
|
@cursor = previous_cursor
|
@@ -79,13 +77,23 @@ class Code
|
|
79
77
|
|
80
78
|
def parse_regular_parameter
|
81
79
|
previous_cursor = cursor
|
80
|
+
|
82
81
|
comments_before = parse_comments
|
83
82
|
|
84
|
-
|
83
|
+
if match(AMPERSAND)
|
84
|
+
kind = :block
|
85
|
+
elsif match(ASTERISK + ASTERISK)
|
86
|
+
kind = :keyword_splat
|
87
|
+
elsif match(ASTERISK)
|
88
|
+
kind = :regular_splat
|
89
|
+
else
|
90
|
+
kind = nil
|
91
|
+
end
|
85
92
|
|
93
|
+
name = parse_subclass(::Code::Parser::Name)
|
86
94
|
comments_after = parse_comments
|
87
95
|
|
88
|
-
if
|
96
|
+
if name
|
89
97
|
if match(EQUAL)
|
90
98
|
default = parse_code
|
91
99
|
else
|
@@ -93,10 +101,11 @@ class Code
|
|
93
101
|
end
|
94
102
|
|
95
103
|
{
|
104
|
+
kind: kind,
|
105
|
+
name: name,
|
96
106
|
default: default,
|
97
107
|
comments_before: comments_before,
|
98
|
-
comments_after: comments_after
|
99
|
-
identifier: identifier
|
108
|
+
comments_after: comments_after
|
100
109
|
}.compact
|
101
110
|
else
|
102
111
|
@cursor = previous_cursor
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Code
|
2
|
+
class Parser
|
3
|
+
class Name < ::Code::Parser
|
4
|
+
def parse
|
5
|
+
return if end_of_input?
|
6
|
+
return if next?(SPECIAL)
|
7
|
+
return if next?(KEYWORDS)
|
8
|
+
consume while !next?(SPECIAL) && !end_of_input?
|
9
|
+
match(QUESTION_MARK) || match(EXCLAMATION_POINT)
|
10
|
+
buffer!
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/code/parser/negation.rb
CHANGED
@@ -12,17 +12,21 @@ class Code
|
|
12
12
|
previous_cursor = cursor
|
13
13
|
left = parse_subclass(subclass)
|
14
14
|
if left
|
15
|
-
right = []
|
16
15
|
previous_cursor = cursor
|
17
16
|
comments = parse_comments
|
17
|
+
right = []
|
18
18
|
|
19
19
|
while operator = match(operators)
|
20
|
-
|
20
|
+
comments_before = parse_comments
|
21
21
|
statement = parse_subclass(subclass)
|
22
|
+
previous_cursor = cursor
|
23
|
+
comments_after = parse_comments
|
24
|
+
|
22
25
|
right << {
|
23
|
-
comments: comments,
|
24
26
|
statement: statement,
|
25
|
-
operator: operator
|
27
|
+
operator: operator,
|
28
|
+
comments_before: comments_before,
|
29
|
+
comments_after: comments_after
|
26
30
|
}.compact
|
27
31
|
end
|
28
32
|
|
@@ -31,11 +35,16 @@ class Code
|
|
31
35
|
buffer!
|
32
36
|
left
|
33
37
|
else
|
38
|
+
@cursor = previous_cursor
|
39
|
+
buffer!
|
40
|
+
|
41
|
+
right[-1].delete(:comments_after)
|
42
|
+
|
34
43
|
{
|
35
44
|
operation: {
|
36
45
|
left: left,
|
37
|
-
|
38
|
-
|
46
|
+
right: right,
|
47
|
+
comments: comments
|
39
48
|
}.compact
|
40
49
|
}
|
41
50
|
end
|
data/lib/code/parser/power.rb
CHANGED
@@ -2,8 +2,8 @@ class Code
|
|
2
2
|
class Parser
|
3
3
|
class Power < ::Code::Parser
|
4
4
|
def parse
|
5
|
-
previous_cursor = cursor
|
6
5
|
left = parse_subclass(::Code::Parser::Negation)
|
6
|
+
previous_cursor = cursor
|
7
7
|
comments_before = parse_comments
|
8
8
|
if match(ASTERISK + ASTERISK)
|
9
9
|
comments_after = parse_comments
|
@@ -20,12 +20,12 @@ class Code
|
|
20
20
|
else
|
21
21
|
@cursor = previous_cursor
|
22
22
|
buffer!
|
23
|
-
|
23
|
+
left
|
24
24
|
end
|
25
25
|
else
|
26
26
|
@cursor = previous_cursor
|
27
27
|
buffer!
|
28
|
-
|
28
|
+
left
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Code
|
2
|
+
class Parser
|
3
|
+
class Splat < ::Code::Parser
|
4
|
+
def parse
|
5
|
+
previous_cursor = cursor
|
6
|
+
|
7
|
+
if operator = match([AMPERSAND, ASTERISK + ASTERISK, ASTERISK])
|
8
|
+
comments = parse_comments
|
9
|
+
right = parse_next
|
10
|
+
if right
|
11
|
+
{
|
12
|
+
splat: {
|
13
|
+
right: right,
|
14
|
+
operator: operator,
|
15
|
+
comments: comments
|
16
|
+
}.compact
|
17
|
+
}
|
18
|
+
else
|
19
|
+
@cursor = previous_cursor
|
20
|
+
buffer!
|
21
|
+
parse_next
|
22
|
+
end
|
23
|
+
else
|
24
|
+
parse_next
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def parse_next
|
31
|
+
parse_subclass(::Code::Parser::Function)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/template/parser.rb
CHANGED
data/spec/code/parser/if_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: template-ruby-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Like "Hello {name}" with {name: "Dorian"} gives "Hello Dorian"'
|
14
14
|
email: dorian@dorianmarie.fr
|
@@ -28,6 +28,8 @@ files:
|
|
28
28
|
- code-ruby-parser.gemspec
|
29
29
|
- docs/class.code
|
30
30
|
- docs/meetup.code
|
31
|
+
- docs/precedence.code
|
32
|
+
- docs/precedence.template
|
31
33
|
- docs/rain.code
|
32
34
|
- docs/slack.code
|
33
35
|
- docs/stripe.code
|
@@ -53,11 +55,11 @@ files:
|
|
53
55
|
- lib/code/parser/function.rb
|
54
56
|
- lib/code/parser/greater_than.rb
|
55
57
|
- lib/code/parser/group.rb
|
56
|
-
- lib/code/parser/identifier.rb
|
57
58
|
- lib/code/parser/if.rb
|
58
59
|
- lib/code/parser/if_modifier.rb
|
59
60
|
- lib/code/parser/list.rb
|
60
61
|
- lib/code/parser/multiplication.rb
|
62
|
+
- lib/code/parser/name.rb
|
61
63
|
- lib/code/parser/negation.rb
|
62
64
|
- lib/code/parser/not_keyword.rb
|
63
65
|
- lib/code/parser/nothing.rb
|
@@ -69,6 +71,7 @@ files:
|
|
69
71
|
- lib/code/parser/range.rb
|
70
72
|
- lib/code/parser/rescue.rb
|
71
73
|
- lib/code/parser/shift.rb
|
74
|
+
- lib/code/parser/splat.rb
|
72
75
|
- lib/code/parser/statement.rb
|
73
76
|
- lib/code/parser/string.rb
|
74
77
|
- lib/code/parser/ternary.rb
|
@@ -110,6 +113,7 @@ files:
|
|
110
113
|
- spec/code/parser/ternary_spec.rb
|
111
114
|
- spec/code/parser/unary_minus_spec.rb
|
112
115
|
- spec/code/parser/while_spec.rb
|
116
|
+
- spec/code/parser_spec.rb
|
113
117
|
- spec/spec_helper.rb
|
114
118
|
- spec/template/parser_spec.rb
|
115
119
|
- template-ruby-parser.gemspec
|
@@ -170,5 +174,6 @@ test_files:
|
|
170
174
|
- spec/code/parser/ternary_spec.rb
|
171
175
|
- spec/code/parser/unary_minus_spec.rb
|
172
176
|
- spec/code/parser/while_spec.rb
|
177
|
+
- spec/code/parser_spec.rb
|
173
178
|
- spec/spec_helper.rb
|
174
179
|
- spec/template/parser_spec.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
class Code
|
2
|
-
class Parser
|
3
|
-
class Identifier < ::Code::Parser
|
4
|
-
def initialize(input, simple: false, **kargs)
|
5
|
-
super(input, **kargs)
|
6
|
-
@simple = simple
|
7
|
-
end
|
8
|
-
|
9
|
-
def parse
|
10
|
-
return if end_of_input?
|
11
|
-
|
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?
|
20
|
-
|
21
|
-
match(QUESTION_MARK) || match(EXCLAMATION_POINT) if !simple?
|
22
|
-
|
23
|
-
name = buffer!
|
24
|
-
|
25
|
-
{ name: name }
|
26
|
-
else
|
27
|
-
return
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
attr_reader :simple
|
34
|
-
|
35
|
-
def simple?
|
36
|
-
!!simple
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|