diff options
author | Aleksey Kladov <[email protected]> | 2018-07-31 10:32:53 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-31 10:32:53 +0100 |
commit | ff71cb1f6de07479610fb0f45e740b249e8a01c6 (patch) | |
tree | 29df6315075f7e0339e8687a78a5bfcef776f900 /src/parser | |
parent | c244dd10343ff96a73879c593bd9253c4073cb90 (diff) |
Introduce param & arg list
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/grammar/expressions.rs | 9 | ||||
-rw-r--r-- | src/parser/grammar/mod.rs | 2 |
2 files changed, 10 insertions, 1 deletions
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 { | |||
70 | fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 70 | fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
71 | assert!(p.at(L_PAREN)); | 71 | assert!(p.at(L_PAREN)); |
72 | let m = lhs.precede(p); | 72 | let m = lhs.precede(p); |
73 | arg_list(p); | ||
74 | m.complete(p, CALL_EXPR) | ||
75 | } | ||
76 | |||
77 | fn arg_list(p: &mut Parser) { | ||
78 | assert!(p.at(L_PAREN)); | ||
79 | let m = p.start(); | ||
73 | p.bump(); | 80 | p.bump(); |
74 | while !p.at(R_PAREN) && !p.at(EOF) { | 81 | while !p.at(R_PAREN) && !p.at(EOF) { |
75 | expr(p); | 82 | expr(p); |
@@ -78,7 +85,7 @@ fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
78 | } | 85 | } |
79 | } | 86 | } |
80 | p.eat(R_PAREN); | 87 | p.eat(R_PAREN); |
81 | m.complete(p, CALL_EXPR) | 88 | m.complete(p, ARG_LIST); |
82 | } | 89 | } |
83 | 90 | ||
84 | // test path_expr | 91 | // 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) { | |||
99 | // fn d(x: i32, y: ()) {} | 99 | // fn d(x: i32, y: ()) {} |
100 | fn fn_value_parameters(p: &mut Parser) { | 100 | fn fn_value_parameters(p: &mut Parser) { |
101 | assert!(p.at(L_PAREN)); | 101 | assert!(p.at(L_PAREN)); |
102 | let m = p.start(); | ||
102 | p.bump(); | 103 | p.bump(); |
103 | while !p.at(EOF) && !p.at(R_PAREN) { | 104 | while !p.at(EOF) && !p.at(R_PAREN) { |
104 | value_parameter(p); | 105 | value_parameter(p); |
@@ -107,6 +108,7 @@ fn fn_value_parameters(p: &mut Parser) { | |||
107 | } | 108 | } |
108 | } | 109 | } |
109 | p.expect(R_PAREN); | 110 | p.expect(R_PAREN); |
111 | m.complete(p, PARAM_LIST); | ||
110 | 112 | ||
111 | fn value_parameter(p: &mut Parser) { | 113 | fn value_parameter(p: &mut Parser) { |
112 | let m = p.start(); | 114 | let m = p.start(); |