mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Add macro pat parsing
This commit is contained in:
parent
6618d1edc3
commit
b454eb5a60
3 changed files with 49 additions and 1 deletions
|
@ -40,6 +40,15 @@ pub(super) fn pattern_r(p: &mut Parser, recovery_set: TokenSet) {
|
|||
atom_pat(p, recovery_set);
|
||||
m.complete(p, RANGE_PAT);
|
||||
}
|
||||
// test marco_pat
|
||||
// fn main() {
|
||||
// let m!(x) = 0;
|
||||
// }
|
||||
else if lhs.kind() == PATH_PAT && p.at(EXCL) {
|
||||
let m = lhs.precede(p);
|
||||
items::macro_call_after_excl(p);
|
||||
m.complete(p, MACRO_CALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +60,7 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> {
|
|||
let la1 = p.nth(1);
|
||||
if la0 == REF_KW
|
||||
|| la0 == MUT_KW
|
||||
|| (la0 == IDENT && !(la1 == COLONCOLON || la1 == L_PAREN || la1 == L_CURLY))
|
||||
|| (la0 == IDENT && !(la1 == COLONCOLON || la1 == L_PAREN || la1 == L_CURLY || la1 == EXCL))
|
||||
{
|
||||
return Some(bind_pat(p, true));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue