syntax: Stop the bump loop for trait items at } and EOF.

This commit is contained in:
Eduard Burtescu
2016-03-26 21:37:53 +02:00
parent 6abab49029
commit 221d0fbad0
6 changed files with 38 additions and 14 deletions

View File

@@ -957,7 +957,9 @@ impl<'a> Parser<'a> {
{
self.expect(bra)?;
let result = self.parse_seq_to_before_end(ket, sep, f);
self.bump();
if self.token == *ket {
self.bump();
}
Ok(result)
}
@@ -1292,15 +1294,21 @@ impl<'a> Parser<'a> {
Ok(cua) => cua,
Err(e) => {
loop {
p.bump();
if p.token == token::Semi {
p.bump();
break;
}
match p.token {
token::Eof => break,
if p.token == token::OpenDelim(token::DelimToken::Brace) {
p.parse_token_tree()?;
break;
token::CloseDelim(token::Brace) |
token::Semi => {
p.bump();
break;
}
token::OpenDelim(token::Brace) => {
p.parse_token_tree()?;
break;
}
_ => p.bump()
}
}