aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/attributes.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-12 16:06:49 +0100
committerAleksey Kladov <[email protected]>2020-08-12 16:14:23 +0100
commit50a02eb3593591a02677e1b56f24d7ff0459b9d0 (patch)
treea17351b1e3addea0a719f38990fea9289b6ef65e /crates/ra_parser/src/grammar/attributes.rs
parent6dafc13f5f776980cd2560fb79d3d4790811c96d (diff)
Rename ra_parser -> parser
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}