aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-30 09:46:08 +0100
committerGitHub <[email protected]>2019-09-30 09:46:08 +0100
commit733f1d8b709788225bd06f8c0aee1819db92620b (patch)
treed17395e4c3f7965c5cf9bdd50ef940e52eef1155 /crates/ra_parser/src/grammar
parentc913b48928107710d6ec87a455b1ae6891297c2b (diff)
parentf7e12559cb26b59a9a2ecee4deecaf6fe9100d16 (diff)
Merge #1934
1934: Parse Path and AttrInput in Attr r=matklad a=uHOOCCOOHu [Syntax reference](https://doc.rust-lang.org/reference/attributes.html#attributes) Co-authored-by: uHOOCCOOHu <[email protected]>
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 }