diff options
Diffstat (limited to 'src')
-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 | ||||
-rw-r--r-- | src/utils.rs | 8 |
4 files changed, 17 insertions, 16 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 | } |
diff --git a/src/utils.rs b/src/utils.rs index 327d89a24..a23a57423 100644 --- a/src/utils.rs +++ b/src/utils.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::{fmt::Write}; | 1 | use std::fmt::Write; |
2 | use { | 2 | use { |
3 | algo::walk::{walk, WalkEvent}, | ||
3 | SyntaxNode, | 4 | SyntaxNode, |
4 | algo::walk::{WalkEvent, walk}, | ||
5 | }; | 5 | }; |
6 | 6 | ||
7 | /// Parse a file and create a string representation of the resulting parse tree. | 7 | /// Parse a file and create a string representation of the resulting parse tree. |
@@ -34,13 +34,13 @@ pub fn dump_tree(syntax: &SyntaxNode) -> String { | |||
34 | } | 34 | } |
35 | } | 35 | } |
36 | level += 1; | 36 | level += 1; |
37 | }, | 37 | } |
38 | WalkEvent::Exit(_) => level -= 1, | 38 | WalkEvent::Exit(_) => level -= 1, |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | assert_eq!(level, 0); | 42 | assert_eq!(level, 0); |
43 | for err in errors[err_pos..].iter() { | 43 | for err in errors[err_pos..].iter() { |
44 | writeln!(buf, "err: `{}`", err.message).unwrap(); | 44 | writeln!(buf, "err: `{}`", err.message).unwrap(); |
45 | } | 45 | } |
46 | 46 | ||