mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Fix macro_rules separator parsing.
macro_rules rules are separated by ';' including an optional ';' at the end
This commit is contained in:
parent
4c0ab7db85
commit
31d143ba18
2 changed files with 49 additions and 1 deletions
|
@ -7,7 +7,13 @@ pub(crate) fn parse(tt: &tt::Subtree) -> Option<crate::MacroRules> {
|
|||
let mut parser = TtCursor::new(tt);
|
||||
let mut rules = Vec::new();
|
||||
while !parser.is_eof() {
|
||||
rules.push(parse_rule(&mut parser)?)
|
||||
rules.push(parse_rule(&mut parser)?);
|
||||
if parser.expect_char(';') == None {
|
||||
if !parser.is_eof() {
|
||||
return None;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Some(crate::MacroRules { rules })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue