From ff71cb1f6de07479610fb0f45e740b249e8a01c6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Jul 2018 12:32:53 +0300 Subject: Introduce param & arg list --- src/parser/grammar/expressions.rs | 9 ++++++++- src/parser/grammar/mod.rs | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/parser/grammar') diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs index 92aaafa3d..7991b1921 100644 --- a/src/parser/grammar/expressions.rs +++ b/src/parser/grammar/expressions.rs @@ -70,6 +70,13 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker { fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(L_PAREN)); let m = lhs.precede(p); + arg_list(p); + m.complete(p, CALL_EXPR) +} + +fn arg_list(p: &mut Parser) { + assert!(p.at(L_PAREN)); + let m = p.start(); p.bump(); while !p.at(R_PAREN) && !p.at(EOF) { expr(p); @@ -78,7 +85,7 @@ fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { } } p.eat(R_PAREN); - m.complete(p, CALL_EXPR) + m.complete(p, ARG_LIST); } // test path_expr diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index 63ad2782e..c2da775a2 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs @@ -99,6 +99,7 @@ fn abi(p: &mut Parser) { // fn d(x: i32, y: ()) {} fn fn_value_parameters(p: &mut Parser) { assert!(p.at(L_PAREN)); + let m = p.start(); p.bump(); while !p.at(EOF) && !p.at(R_PAREN) { value_parameter(p); @@ -107,6 +108,7 @@ fn fn_value_parameters(p: &mut Parser) { } } p.expect(R_PAREN); + m.complete(p, PARAM_LIST); fn value_parameter(p: &mut Parser) { let m = p.start(); -- cgit v1.2.3