2018-01-07 19:46:10 +01:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
pub(super) fn inner_attributes(p: &mut Parser) {
|
2018-02-11 11:13:06 +01:00
|
|
|
while p.current() == POUND && p.nth(1) == EXCL {
|
2018-01-20 22:31:29 +01:00
|
|
|
attribute(p, true)
|
|
|
|
}
|
2018-01-07 19:46:10 +01:00
|
|
|
}
|
|
|
|
|
2018-01-11 21:01:12 +01:00
|
|
|
pub(super) fn outer_attributes(p: &mut Parser) {
|
2018-01-20 22:31:29 +01:00
|
|
|
while p.at(POUND) {
|
|
|
|
attribute(p, false)
|
|
|
|
}
|
2018-01-07 19:46:10 +01:00
|
|
|
}
|
|
|
|
|
2018-01-28 00:31:23 +01:00
|
|
|
fn attribute(p: &mut Parser, inner: bool) {
|
2018-01-20 22:31:29 +01:00
|
|
|
let attr = p.start();
|
|
|
|
assert!(p.at(POUND));
|
|
|
|
p.bump();
|
|
|
|
|
|
|
|
if inner {
|
|
|
|
assert!(p.at(EXCL));
|
2018-01-20 19:49:58 +01:00
|
|
|
p.bump();
|
2018-01-08 20:40:14 +01:00
|
|
|
}
|
2018-01-20 22:31:29 +01:00
|
|
|
|
2018-08-16 11:51:40 +02:00
|
|
|
if p.at(L_BRACK) {
|
|
|
|
items::token_tree(p);
|
2018-01-20 19:49:58 +01:00
|
|
|
} else {
|
2018-08-16 11:51:40 +02:00
|
|
|
p.error("expected `[`");
|
2018-01-20 22:31:29 +01:00
|
|
|
}
|
2018-08-16 11:51:40 +02:00
|
|
|
attr.complete(p, ATTR);
|
2018-01-20 22:31:29 +01:00
|
|
|
}
|