Skip to content

Commit 2c2a463

Browse files
committed
Match command_call/arg
A couple more deviations from the parse.y grammar with the command_call and arg productions. * pm_block_call_p — allow parens on chain links (meth 1 do end.fun(x)) * pm_command_call_value_p — recognize const-path brace commands (Foo::Bar { }) * super with do/end as a block_call (chaining: super 1 do end.baz) * foo(Foo::Bar { } => v)
1 parent b510edd commit 2c2a463

7 files changed

Lines changed: 279 additions & 129 deletions

File tree

snapshots/super.txt

Lines changed: 96 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
@ ProgramNode (location: (1,0)-(17,21))
1+
@ ProgramNode (location: (1,0)-(21,21))
22
├── flags: ∅
33
├── locals: []
44
└── statements:
5-
@ StatementsNode (location: (1,0)-(17,21))
5+
@ StatementsNode (location: (1,0)-(21,21))
66
├── flags: ∅
7-
└── body: (length: 9)
7+
└── body: (length: 11)
88
├── @ ForwardingSuperNode (location: (1,0)-(1,5))
99
│ ├── flags: newline
1010
│ ├── keyword_loc: (1,0)-(1,5) = "super"
@@ -119,32 +119,100 @@
119119
│ ├── body: ∅
120120
│ ├── opening_loc: (15,15)-(15,16) = "{"
121121
│ └── closing_loc: (15,16)-(15,17) = "}"
122-
└── @ SuperNode (location: (17,0)-(17,21))
122+
├── @ SuperNode (location: (17,0)-(17,21))
123+
│ ├── flags: newline
124+
│ ├── keyword_loc: (17,0)-(17,5) = "super"
125+
│ ├── lparen_loc: (17,5)-(17,6) = "("
126+
│ ├── arguments:
127+
│ │ @ ArgumentsNode (location: (17,6)-(17,13))
128+
│ │ ├── flags: ∅
129+
│ │ └── arguments: (length: 3)
130+
│ │ ├── @ IntegerNode (location: (17,6)-(17,7))
131+
│ │ │ ├── flags: static_literal, decimal
132+
│ │ │ └── value: 1
133+
│ │ ├── @ IntegerNode (location: (17,9)-(17,10))
134+
│ │ │ ├── flags: static_literal, decimal
135+
│ │ │ └── value: 2
136+
│ │ └── @ IntegerNode (location: (17,12)-(17,13))
137+
│ │ ├── flags: static_literal, decimal
138+
│ │ └── value: 3
139+
│ ├── rparen_loc: (17,20)-(17,21) = ")"
140+
│ └── block:
141+
│ @ BlockArgumentNode (location: (17,15)-(17,20))
142+
│ ├── flags: ∅
143+
│ ├── expression:
144+
│ │ @ SymbolNode (location: (17,16)-(17,20))
145+
│ │ ├── flags: static_literal, forced_us_ascii_encoding
146+
│ │ ├── opening_loc: (17,16)-(17,17) = ":"
147+
│ │ ├── value_loc: (17,17)-(17,20) = "foo"
148+
│ │ ├── closing_loc: ∅
149+
│ │ └── unescaped: "foo"
150+
│ └── operator_loc: (17,15)-(17,16) = "&"
151+
├── @ CallNode (location: (19,0)-(19,18))
152+
│ ├── flags: newline
153+
│ ├── receiver:
154+
│ │ @ SuperNode (location: (19,0)-(19,14))
155+
│ │ ├── flags: ∅
156+
│ │ ├── keyword_loc: (19,0)-(19,5) = "super"
157+
│ │ ├── lparen_loc: ∅
158+
│ │ ├── arguments:
159+
│ │ │ @ ArgumentsNode (location: (19,6)-(19,7))
160+
│ │ │ ├── flags: ∅
161+
│ │ │ └── arguments: (length: 1)
162+
│ │ │ └── @ IntegerNode (location: (19,6)-(19,7))
163+
│ │ │ ├── flags: static_literal, decimal
164+
│ │ │ └── value: 1
165+
│ │ ├── rparen_loc: ∅
166+
│ │ └── block:
167+
│ │ @ BlockNode (location: (19,8)-(19,14))
168+
│ │ ├── flags: ∅
169+
│ │ ├── locals: []
170+
│ │ ├── parameters: ∅
171+
│ │ ├── body: ∅
172+
│ │ ├── opening_loc: (19,8)-(19,10) = "do"
173+
│ │ └── closing_loc: (19,11)-(19,14) = "end"
174+
│ ├── call_operator_loc: (19,14)-(19,15) = "."
175+
│ ├── name: :baz
176+
│ ├── message_loc: (19,15)-(19,18) = "baz"
177+
│ ├── opening_loc: ∅
178+
│ ├── arguments: ∅
179+
│ ├── closing_loc: ∅
180+
│ ├── equal_loc: ∅
181+
│ └── block: ∅
182+
└── @ CallNode (location: (21,0)-(21,21))
123183
├── flags: newline
124-
├── keyword_loc: (17,0)-(17,5) = "super"
125-
├── lparen_loc: (17,5)-(17,6) = "("
184+
├── receiver:
185+
│ @ SuperNode (location: (21,0)-(21,14))
186+
│ ├── flags: ∅
187+
│ ├── keyword_loc: (21,0)-(21,5) = "super"
188+
│ ├── lparen_loc: ∅
189+
│ ├── arguments:
190+
│ │ @ ArgumentsNode (location: (21,6)-(21,7))
191+
│ │ ├── flags: ∅
192+
│ │ └── arguments: (length: 1)
193+
│ │ └── @ IntegerNode (location: (21,6)-(21,7))
194+
│ │ ├── flags: static_literal, decimal
195+
│ │ └── value: 1
196+
│ ├── rparen_loc: ∅
197+
│ └── block:
198+
│ @ BlockNode (location: (21,8)-(21,14))
199+
│ ├── flags: ∅
200+
│ ├── locals: []
201+
│ ├── parameters: ∅
202+
│ ├── body: ∅
203+
│ ├── opening_loc: (21,8)-(21,10) = "do"
204+
│ └── closing_loc: (21,11)-(21,14) = "end"
205+
├── call_operator_loc: (21,14)-(21,15) = "."
206+
├── name: :baz
207+
├── message_loc: (21,15)-(21,18) = "baz"
208+
├── opening_loc: (21,18)-(21,19) = "("
126209
├── arguments:
127-
│ @ ArgumentsNode (location: (17,6)-(17,13))
210+
│ @ ArgumentsNode (location: (21,19)-(21,20))
128211
│ ├── flags: ∅
129-
│ └── arguments: (length: 3)
130-
│ ├── @ IntegerNode (location: (17,6)-(17,7))
131-
│ │ ├── flags: static_literal, decimal
132-
│ │ └── value: 1
133-
│ ├── @ IntegerNode (location: (17,9)-(17,10))
134-
│ │ ├── flags: static_literal, decimal
135-
│ │ └── value: 2
136-
│ └── @ IntegerNode (location: (17,12)-(17,13))
212+
│ └── arguments: (length: 1)
213+
│ └── @ IntegerNode (location: (21,19)-(21,20))
137214
│ ├── flags: static_literal, decimal
138-
│ └── value: 3
139-
├── rparen_loc: (17,20)-(17,21) = ")"
140-
└── block:
141-
@ BlockArgumentNode (location: (17,15)-(17,20))
142-
├── flags: ∅
143-
├── expression:
144-
│ @ SymbolNode (location: (17,16)-(17,20))
145-
│ ├── flags: static_literal, forced_us_ascii_encoding
146-
│ ├── opening_loc: (17,16)-(17,17) = ":"
147-
│ ├── value_loc: (17,17)-(17,20) = "foo"
148-
│ ├── closing_loc: ∅
149-
│ └── unescaped: "foo"
150-
└── operator_loc: (17,15)-(17,16) = "&"
215+
│ └── value: 2
216+
├── closing_loc: (21,20)-(21,21) = ")"
217+
├── equal_loc: ∅
218+
└── block: ∅

0 commit comments

Comments
 (0)