diff options
author | Evgenii P <[email protected]> | 2019-08-13 16:36:01 +0100 |
---|---|---|
committer | Evgenii P <[email protected]> | 2019-08-13 16:36:01 +0100 |
commit | 8222a1fddfe73dab5e00437efeffa7d95db0b6be (patch) | |
tree | a8520fc5a354fb66b4304e0ddd210c6bfc076e92 /crates/ra_parser/src/grammar/paths.rs | |
parent | f1e62501c3de7932396d29c89588ff296bbcc50d (diff) |
Fix is_path_start to accept T![<], fix is_path_start usages
Diffstat (limited to 'crates/ra_parser/src/grammar/paths.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/paths.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/ra_parser/src/grammar/paths.rs index 3537b0da1..07eb53b0c 100644 --- a/crates/ra_parser/src/grammar/paths.rs +++ b/crates/ra_parser/src/grammar/paths.rs | |||
@@ -4,6 +4,10 @@ pub(super) const PATH_FIRST: TokenSet = | |||
4 | token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLONCOLON, L_ANGLE]; | 4 | token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLONCOLON, L_ANGLE]; |
5 | 5 | ||
6 | pub(super) fn is_path_start(p: &Parser) -> bool { | 6 | pub(super) fn is_path_start(p: &Parser) -> bool { |
7 | is_use_path_start(p) || p.at(T![<]) | ||
8 | } | ||
9 | |||
10 | pub(super) fn is_use_path_start(p: &Parser) -> bool { | ||
7 | match p.current() { | 11 | match p.current() { |
8 | IDENT | T![self] | T![super] | T![crate] | T![::] => true, | 12 | IDENT | T![self] | T![super] | T![crate] | T![::] => true, |
9 | _ => false, | 13 | _ => false, |
@@ -58,7 +62,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) { | |||
58 | if first && p.eat(T![<]) { | 62 | if first && p.eat(T![<]) { |
59 | types::type_(p); | 63 | types::type_(p); |
60 | if p.eat(T![as]) { | 64 | if p.eat(T![as]) { |
61 | if is_path_start(p) { | 65 | if is_use_path_start(p) { |
62 | types::path_type(p); | 66 | types::path_type(p); |
63 | } else { | 67 | } else { |
64 | p.error("expected a trait"); | 68 | p.error("expected a trait"); |