2018-01-07 21:46:10 +03:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
pub(super) fn inner_attributes(p: &mut Parser) {
|
2019-09-09 13:23:37 +03:00
|
|
|
while p.at(T![#]) && p.nth(1) == T![!] {
|
2018-01-21 00:31:29 +03:00
|
|
|
attribute(p, true)
|
|
|
|
}
|
2018-01-07 21:46:10 +03:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:01:12 +03:00
|
|
|
pub(super) fn outer_attributes(p: &mut Parser) {
|
2019-05-15 15:35:47 +03:00
|
|
|
while p.at(T![#]) {
|
2018-01-21 00:31:29 +03:00
|
|
|
attribute(p, false)
|
|
|
|
}
|
2018-01-07 21:46:10 +03:00
|
|
|
}
|
|
|
|
|
2018-01-27 18:31:23 -05:00
|
|
|
fn attribute(p: &mut Parser, inner: bool) {
|
2018-01-21 00:31:29 +03:00
|
|
|
let attr = p.start();
|
2019-05-15 15:35:47 +03:00
|
|
|
assert!(p.at(T![#]));
|
2019-09-10 00:59:29 +03:00
|
|
|
p.bump_any();
|
2018-01-21 00:31:29 +03:00
|
|
|
|
|
|
|
if inner {
|
2019-05-15 15:35:47 +03:00
|
|
|
assert!(p.at(T![!]));
|
2019-09-10 00:59:29 +03:00
|
|
|
p.bump_any();
|
2018-01-08 22:40:14 +03:00
|
|
|
}
|
2018-01-21 00:31:29 +03:00
|
|
|
|
2019-05-15 15:35:47 +03:00
|
|
|
if p.at(T!['[']) {
|
2018-08-16 12:51:40 +03:00
|
|
|
items::token_tree(p);
|
2018-01-20 21:49:58 +03:00
|
|
|
} else {
|
2018-08-16 12:51:40 +03:00
|
|
|
p.error("expected `[`");
|
2018-01-21 00:31:29 +03:00
|
|
|
}
|
2018-08-16 12:51:40 +03:00
|
|
|
attr.complete(p, ATTR);
|
2018-01-21 00:31:29 +03:00
|
|
|
}
|