aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser
diff options
context:
space:
mode:
authoruHOOCCOOHu <[email protected]>2019-09-29 21:44:33 +0100
committeruHOOCCOOHu <[email protected]>2019-09-30 09:11:40 +0100
commit71efdaa6364142b359c59659ec10f35a1e53b5d2 (patch)
tree5dbbbc522bbb52f05d77e2bc0ad2241a57349c86 /crates/ra_parser
parentc913b48928107710d6ec87a455b1ae6891297c2b (diff)
Parse correct AttrInput
Diffstat (limited to 'crates/ra_parser')
-rw-r--r--crates/ra_parser/src/grammar/attributes.rs21
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 }