mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Handle extended key value attr in mbe
This commit is contained in:
parent
df5b6f7d45
commit
c4173bb468
3 changed files with 35 additions and 48 deletions
|
@ -14,6 +14,21 @@ pub(super) fn outer_attrs(p: &mut Parser) {
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn meta(p: &mut Parser) {
|
||||
paths::use_path(p);
|
||||
|
||||
match p.current() {
|
||||
T![=] => {
|
||||
p.bump(T![=]);
|
||||
if expressions::expr(p).0.is_none() {
|
||||
p.error("expected expression");
|
||||
}
|
||||
}
|
||||
T!['('] | T!['['] | T!['{'] => items::token_tree(p),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn attr(p: &mut Parser, inner: bool) {
|
||||
let attr = p.start();
|
||||
assert!(p.at(T![#]));
|
||||
|
@ -25,18 +40,7 @@ fn attr(p: &mut Parser, inner: bool) {
|
|||
}
|
||||
|
||||
if p.eat(T!['[']) {
|
||||
paths::use_path(p);
|
||||
|
||||
match p.current() {
|
||||
T![=] => {
|
||||
p.bump(T![=]);
|
||||
if expressions::expr(p).0.is_none() {
|
||||
p.error("expected expression");
|
||||
}
|
||||
}
|
||||
T!['('] | T!['['] | T!['{'] => items::token_tree(p),
|
||||
_ => {}
|
||||
}
|
||||
meta(p);
|
||||
|
||||
if !p.eat(T![']']) {
|
||||
p.error("expected `]`");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue