diff options
author | Aleksey Kladov <[email protected]> | 2018-07-31 20:29:38 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-31 20:29:38 +0100 |
commit | 904a832b7cfc58bcf91ed7a17a5a177f8d36db1c (patch) | |
tree | 108049f427c2fd14e6d6086987b7368ed8d7c616 /src/parser | |
parent | 8105c14454f8c4f575f16b44ec616ffd045be57f (diff) |
format
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/grammar/expressions.rs | 15 | ||||
-rw-r--r-- | src/parser/grammar/mod.rs | 4 | ||||
-rw-r--r-- | src/parser/grammar/type_args.rs | 6 |
3 files changed, 13 insertions, 12 deletions
diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs index 881d947ac..ef3a0f76c 100644 --- a/src/parser/grammar/expressions.rs +++ b/src/parser/grammar/expressions.rs | |||
@@ -34,12 +34,11 @@ pub(super) fn expr(p: &mut Parser) { | |||
34 | loop { | 34 | loop { |
35 | lhs = match p.current() { | 35 | lhs = match p.current() { |
36 | L_PAREN => call_expr(p, lhs), | 36 | L_PAREN => call_expr(p, lhs), |
37 | DOT if p.nth(1) == IDENT => | 37 | DOT if p.nth(1) == IDENT => if p.nth(2) == L_PAREN { |
38 | if p.nth(2) == L_PAREN { | 38 | method_call_expr(p, lhs) |
39 | method_call_expr(p, lhs) | 39 | } else { |
40 | } else { | 40 | field_expr(p, lhs) |
41 | field_expr(p, lhs) | 41 | }, |
42 | } | ||
43 | _ => break, | 42 | _ => break, |
44 | } | 43 | } |
45 | } | 44 | } |
@@ -193,11 +192,11 @@ fn struct_lit(p: &mut Parser) { | |||
193 | expr(p); | 192 | expr(p); |
194 | } | 193 | } |
195 | m.complete(p, STRUCT_LIT_FIELD); | 194 | m.complete(p, STRUCT_LIT_FIELD); |
196 | }, | 195 | } |
197 | DOTDOT => { | 196 | DOTDOT => { |
198 | p.bump(); | 197 | p.bump(); |
199 | expr(p); | 198 | expr(p); |
200 | }, | 199 | } |
201 | _ => p.err_and_bump("expected identifier"), | 200 | _ => p.err_and_bump("expected identifier"), |
202 | } | 201 | } |
203 | if !p.at(R_CURLY) { | 202 | if !p.at(R_CURLY) { |
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index 53ef28181..69942e7f1 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs | |||
@@ -142,7 +142,9 @@ fn fn_value_parameters(p: &mut Parser) { | |||
142 | _ => return, | 142 | _ => return, |
143 | }; | 143 | }; |
144 | let m = p.start(); | 144 | let m = p.start(); |
145 | for _ in 0..n_toks { p.bump(); } | 145 | for _ in 0..n_toks { |
146 | p.bump(); | ||
147 | } | ||
146 | m.complete(p, SELF_PARAM); | 148 | m.complete(p, SELF_PARAM); |
147 | if !p.at(R_PAREN) { | 149 | if !p.at(R_PAREN) { |
148 | p.expect(COMMA); | 150 | p.expect(COMMA); |
diff --git a/src/parser/grammar/type_args.rs b/src/parser/grammar/type_args.rs index 276c8b4ae..94d76b25a 100644 --- a/src/parser/grammar/type_args.rs +++ b/src/parser/grammar/type_args.rs | |||
@@ -33,16 +33,16 @@ fn type_arg(p: &mut Parser) { | |||
33 | LIFETIME => { | 33 | LIFETIME => { |
34 | p.bump(); | 34 | p.bump(); |
35 | m.complete(p, LIFETIME_ARG); | 35 | m.complete(p, LIFETIME_ARG); |
36 | }, | 36 | } |
37 | IDENT if p.nth(1) == EQ => { | 37 | IDENT if p.nth(1) == EQ => { |
38 | name_ref(p); | 38 | name_ref(p); |
39 | p.bump(); | 39 | p.bump(); |
40 | types::type_(p); | 40 | types::type_(p); |
41 | m.complete(p, ASSOC_TYPE_ARG); | 41 | m.complete(p, ASSOC_TYPE_ARG); |
42 | }, | 42 | } |
43 | _ => { | 43 | _ => { |
44 | types::type_(p); | 44 | types::type_(p); |
45 | m.complete(p, TYPE_ARG); | 45 | m.complete(p, TYPE_ARG); |
46 | }, | 46 | } |
47 | } | 47 | } |
48 | } | 48 | } |