From 40170885e799ebdefb24ed00865cd1c7800af491 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 9 Sep 2019 14:52:31 +0300 Subject: WIP: switch to fully decomposed tokens internally --- crates/ra_parser/src/grammar/paths.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/ra_parser/src/grammar/paths.rs') diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/ra_parser/src/grammar/paths.rs index 345c93f55..24b65128e 100644 --- a/crates/ra_parser/src/grammar/paths.rs +++ b/crates/ra_parser/src/grammar/paths.rs @@ -1,7 +1,7 @@ use super::*; pub(super) const PATH_FIRST: TokenSet = - token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLONCOLON, L_ANGLE]; + token_set![IDENT, SELF_KW, SUPER_KW, CRATE_KW, COLON, L_ANGLE]; pub(super) fn is_path_start(p: &Parser) -> bool { is_use_path_start(p) || p.at(T![<]) @@ -9,7 +9,8 @@ pub(super) fn is_path_start(p: &Parser) -> bool { pub(super) fn is_use_path_start(p: &Parser) -> bool { match p.current() { - IDENT | T![self] | T![super] | T![crate] | T![::] => true, + IDENT | T![self] | T![super] | T![crate] => true, + T![:] if p.at(T![::]) => true, _ => false, } } @@ -38,13 +39,13 @@ fn path(p: &mut Parser, mode: Mode) { path_segment(p, mode, true); let mut qual = path.complete(p, PATH); loop { - let use_tree = match p.nth(1) { + let use_tree = match p.nth(2) { T![*] | T!['{'] => true, _ => false, }; if p.at(T![::]) && !use_tree { let path = qual.precede(p); - p.bump_any(); + p.bump(T![::]); path_segment(p, mode, false); let path = path.complete(p, PATH); qual = path; -- cgit v1.2.3