diff options
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r-- | crates/ra_parser/src/grammar/attributes.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/crates/ra_parser/src/grammar/attributes.rs b/crates/ra_parser/src/grammar/attributes.rs index 1cfd301b5..72e7717b7 100644 --- a/crates/ra_parser/src/grammar/attributes.rs +++ b/crates/ra_parser/src/grammar/attributes.rs | |||
@@ -22,8 +22,25 @@ fn attribute(p: &mut Parser, inner: bool) { | |||
22 | p.bump(T![!]); | 22 | p.bump(T![!]); |
23 | } | 23 | } |
24 | 24 | ||
25 | if p.at(T!['[']) { | 25 | if p.eat(T!['[']) { |
26 | items::token_tree(p); | 26 | paths::use_path(p); |
27 | |||
28 | let is_delimiter = |p: &mut Parser| match p.current() { | ||
29 | T!['('] | T!['['] | T!['{'] => true, | ||
30 | _ => false, | ||
31 | }; | ||
32 | |||
33 | if p.eat(T![=]) { | ||
34 | if expressions::literal(p).is_none() { | ||
35 | p.error("expected literal"); | ||
36 | } | ||
37 | } else if is_delimiter(p) { | ||
38 | items::token_tree(p); | ||
39 | } | ||
40 | |||
41 | if !p.eat(T![']']) { | ||
42 | p.error("expected `]`"); | ||
43 | } | ||
27 | } else { | 44 | } else { |
28 | p.error("expected `[`"); | 45 | p.error("expected `[`"); |
29 | } | 46 | } |