|
@@ -284,17 +284,19 @@ class Parser
|
284
|
284
|
raise "Unexpected token #{token.type}"
|
285
|
285
|
end
|
286
|
286
|
|
287
|
|
- if @current_token.type == TokenKinds::LPAREN
|
|
287
|
+ while @current_token.type == TokenKinds::LPAREN
|
288
|
288
|
args = arguments
|
289
|
|
- AST::FunctionCall.new(expr, args)
|
290
|
|
- elsif @current_token.type == TokenKinds::LBRACKET
|
|
289
|
+ expr = AST::FunctionCall.new(expr, args)
|
|
290
|
+ end
|
|
291
|
+
|
|
292
|
+ while @current_token.type == TokenKinds::LBRACKET
|
291
|
293
|
eat(TokenKinds::LBRACKET)
|
292
|
294
|
key = expression
|
293
|
295
|
eat(TokenKinds::RBRACKET)
|
294
|
|
- AST::Index.new(expr, key)
|
295
|
|
- else
|
296
|
|
- expr
|
|
296
|
+ expr = AST::Index.new(expr, key)
|
297
|
297
|
end
|
|
298
|
+
|
|
299
|
+ expr
|
298
|
300
|
end
|
299
|
301
|
|
300
|
302
|
def function_expression
|