aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/grammar')
-rw-r--r--crates/ra_parser/src/grammar/attributes.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/crates/ra_parser/src/grammar/attributes.rs b/crates/ra_parser/src/grammar/attributes.rs
index 1cfd301b5..63ca9ca32 100644
--- a/crates/ra_parser/src/grammar/attributes.rs
+++ b/crates/ra_parser/src/grammar/attributes.rs
@@ -22,8 +22,23 @@ 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 match p.current() {
29 T![=] => {
30 p.bump(T![=]);
31 if expressions::literal(p).is_none() {
32 p.error("expected literal");
33 }
34 }
35 T!['('] | T!['['] | T!['{'] => items::token_tree(p),
36 _ => {}
37 }
38
39 if !p.eat(T![']']) {
40 p.error("expected `]`");
41 }
27 } else { 42 } else {
28 p.error("expected `[`"); 43 p.error("expected `[`");
29 } 44 }