aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/attributes.rs
diff options
context:
space:
mode:
authorZac Pullar-Strecker <[email protected]>2020-08-24 10:19:53 +0100
committerZac Pullar-Strecker <[email protected]>2020-08-24 10:20:13 +0100
commit7bbca7a1b3f9293d2f5cc5745199bc5f8396f2f0 (patch)
treebdb47765991cb973b2cd5481a088fac636bd326c /crates/ra_parser/src/grammar/attributes.rs
parentca464650eeaca6195891199a93f4f76cf3e7e697 (diff)
parente65d48d1fb3d4d91d9dc1148a7a836ff5c9a3c87 (diff)
Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links
Diffstat (limited to 'crates/ra_parser/src/grammar/attributes.rs')
-rw-r--r--crates/ra_parser/src/grammar/attributes.rs48
1 files changed, 0 insertions, 48 deletions
diff --git a/crates/ra_parser/src/grammar/attributes.rs b/crates/ra_parser/src/grammar/attributes.rs
deleted file mode 100644
index f3158ade3..000000000
--- a/crates/ra_parser/src/grammar/attributes.rs
+++ /dev/null
@@ -1,48 +0,0 @@
1//! FIXME: write short doc here
2
3use super::*;
4
5pub(super) fn inner_attributes(p: &mut Parser) {
6 while p.at(T![#]) && p.nth(1) == T![!] {
7 attribute(p, true)
8 }
9}
10
11pub(super) fn outer_attributes(p: &mut Parser) {
12 while p.at(T![#]) {
13 attribute(p, false)
14 }
15}
16
17fn attribute(p: &mut Parser, inner: bool) {
18 let attr = p.start();
19 assert!(p.at(T![#]));
20 p.bump(T![#]);
21
22 if inner {
23 assert!(p.at(T![!]));
24 p.bump(T![!]);
25 }
26
27 if p.eat(T!['[']) {
28 paths::use_path(p);
29
30 match p.current() {
31 T![=] => {
32 p.bump(T![=]);
33 if expressions::literal(p).is_none() {
34 p.error("expected literal");
35 }
36 }
37 T!['('] | T!['['] | T!['{'] => items::token_tree(p),
38 _ => {}
39 }
40
41 if !p.eat(T![']']) {
42 p.error("expected `]`");
43 }
44 } else {
45 p.error("expected `[`");
46 }
47 attr.complete(p, ATTR);
48}