diff options
author | Edwin Cheng <[email protected]> | 2019-04-30 16:22:48 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-04-30 16:22:48 +0100 |
commit | b454eb5a600779a9ab6f7bea251772bdd98b81b9 (patch) | |
tree | 572a20acd744ee57f44db1acd7219d3235f03a32 /crates/ra_parser/src/grammar | |
parent | 6618d1edc3edaad9ebdc216e6d7423ac9ac6a265 (diff) |
Add macro pat parsing
Diffstat (limited to 'crates/ra_parser/src/grammar')
-rw-r--r-- | crates/ra_parser/src/grammar/patterns.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index 03fa9b71e..12dd22bde 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs | |||
@@ -40,6 +40,15 @@ pub(super) fn pattern_r(p: &mut Parser, recovery_set: TokenSet) { | |||
40 | atom_pat(p, recovery_set); | 40 | atom_pat(p, recovery_set); |
41 | m.complete(p, RANGE_PAT); | 41 | m.complete(p, RANGE_PAT); |
42 | } | 42 | } |
43 | // test marco_pat | ||
44 | // fn main() { | ||
45 | // let m!(x) = 0; | ||
46 | // } | ||
47 | else if lhs.kind() == PATH_PAT && p.at(EXCL) { | ||
48 | let m = lhs.precede(p); | ||
49 | items::macro_call_after_excl(p); | ||
50 | m.complete(p, MACRO_CALL); | ||
51 | } | ||
43 | } | 52 | } |
44 | } | 53 | } |
45 | 54 | ||
@@ -51,7 +60,7 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> { | |||
51 | let la1 = p.nth(1); | 60 | let la1 = p.nth(1); |
52 | if la0 == REF_KW | 61 | if la0 == REF_KW |
53 | || la0 == MUT_KW | 62 | || la0 == MUT_KW |
54 | || (la0 == IDENT && !(la1 == COLONCOLON || la1 == L_PAREN || la1 == L_CURLY)) | 63 | || (la0 == IDENT && !(la1 == COLONCOLON || la1 == L_PAREN || la1 == L_CURLY || la1 == EXCL)) |
55 | { | 64 | { |
56 | return Some(bind_pat(p, true)); | 65 | return Some(bind_pat(p, true)); |
57 | } | 66 | } |