diff options
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar/paths.rs | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/patterns.rs | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/ra_parser/src/grammar/paths.rs index 332acc1a0..428aa711e 100644 --- a/crates/ra_parser/src/grammar/paths.rs +++ b/crates/ra_parser/src/grammar/paths.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use super::*; | 3 | use super::*; |
4 | 4 | ||
5 | pub(super) const PATH_FIRST: TokenSet = | 5 | pub(super) const PATH_FIRST: TokenSet = |
6 | token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLON, L_ANGLE]; | 6 | token_set![IDENT, T![self], T![super], T![crate], T![:], T![<]]; |
7 | 7 | ||
8 | pub(super) fn is_path_start(p: &Parser) -> bool { | 8 | pub(super) fn is_path_start(p: &Parser) -> bool { |
9 | is_use_path_start(p) || p.at(T![<]) | 9 | is_use_path_start(p) || p.at(T![<]) |
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index 68fb2fc73..427c0eb49 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs | |||
@@ -4,7 +4,7 @@ use super::*; | |||
4 | 4 | ||
5 | pub(super) const PATTERN_FIRST: TokenSet = expressions::LITERAL_FIRST | 5 | pub(super) const PATTERN_FIRST: TokenSet = expressions::LITERAL_FIRST |
6 | .union(paths::PATH_FIRST) | 6 | .union(paths::PATH_FIRST) |
7 | .union(token_set![BOX_KW, REF_KW, MUT_KW, L_PAREN, L_BRACK, AMP, UNDERSCORE, MINUS, DOT]); | 7 | .union(token_set![T![box], T![ref], T![mut], T!['('], T!['['], T![&], T![_], T![-], T![.]]); |
8 | 8 | ||
9 | pub(crate) fn pattern(p: &mut Parser) { | 9 | pub(crate) fn pattern(p: &mut Parser) { |
10 | pattern_r(p, PAT_RECOVERY_SET); | 10 | pattern_r(p, PAT_RECOVERY_SET); |
@@ -88,7 +88,9 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> { | |||
88 | _ => bind_pat(p, true), | 88 | _ => bind_pat(p, true), |
89 | }, | 89 | }, |
90 | 90 | ||
91 | _ if paths::is_use_path_start(p) => path_or_macro_pat(p), | 91 | // test type_path_in_pattern |
92 | // fn main() { let <_>::Foo = (); } | ||
93 | _ if paths::is_path_start(p) => path_or_macro_pat(p), | ||
92 | _ if is_literal_pat_start(p) => literal_pat(p), | 94 | _ if is_literal_pat_start(p) => literal_pat(p), |
93 | 95 | ||
94 | T![.] if p.at(T![..]) => dot_dot_pat(p), | 96 | T![.] if p.at(T![..]) => dot_dot_pat(p), |
@@ -138,7 +140,7 @@ fn literal_pat(p: &mut Parser) -> CompletedMarker { | |||
138 | // let Bar(..) = (); | 140 | // let Bar(..) = (); |
139 | // } | 141 | // } |
140 | fn path_or_macro_pat(p: &mut Parser) -> CompletedMarker { | 142 | fn path_or_macro_pat(p: &mut Parser) -> CompletedMarker { |
141 | assert!(paths::is_use_path_start(p)); | 143 | assert!(paths::is_path_start(p)); |
142 | let m = p.start(); | 144 | let m = p.start(); |
143 | paths::expr_path(p); | 145 | paths::expr_path(p); |
144 | let kind = match p.current() { | 146 | let kind = match p.current() { |