mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Parse correct AttrInput
This commit is contained in:
parent
c913b48928
commit
71efdaa636
33 changed files with 844 additions and 601 deletions
|
@ -22,8 +22,25 @@ fn attribute(p: &mut Parser, inner: bool) {
|
|||
p.bump(T![!]);
|
||||
}
|
||||
|
||||
if p.at(T!['[']) {
|
||||
items::token_tree(p);
|
||||
if p.eat(T!['[']) {
|
||||
paths::use_path(p);
|
||||
|
||||
let is_delimiter = |p: &mut Parser| match p.current() {
|
||||
T!['('] | T!['['] | T!['{'] => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
if p.eat(T![=]) {
|
||||
if expressions::literal(p).is_none() {
|
||||
p.error("expected literal");
|
||||
}
|
||||
} else if is_delimiter(p) {
|
||||
items::token_tree(p);
|
||||
}
|
||||
|
||||
if !p.eat(T![']']) {
|
||||
p.error("expected `]`");
|
||||
}
|
||||
} else {
|
||||
p.error("expected `[`");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue