Make parse_seq_to_before_tokens take expected/nonexpected tokens, use in parse_precise_capturing_syntax

This commit is contained in:
Michael Goulet 2024-06-05 17:02:18 -04:00
parent 59e2c01c22
commit 68bd001c00
8 changed files with 38 additions and 51 deletions

View file

@ -1,7 +1,6 @@
use super::pat::Expected;
use super::{
BlockMode, CommaRecoveryMode, Parser, PathStyle, Restrictions, SemiColonMode, SeqSep,
TokenExpectType, TokenType,
BlockMode, CommaRecoveryMode, Parser, PathStyle, Restrictions, SemiColonMode, SeqSep, TokenType,
};
use crate::errors::{
AmbiguousPlus, AsyncMoveBlockIn2015, AttributeOnParamType, BadQPathStage2, BadTypePlus,
@ -1045,9 +1044,7 @@ impl<'a> Parser<'a> {
/// passes through any errors encountered. Used for error recovery.
pub(super) fn eat_to_tokens(&mut self, kets: &[&TokenKind]) {
if let Err(err) =
self.parse_seq_to_before_tokens(kets, SeqSep::none(), TokenExpectType::Expect, |p| {
Ok(p.parse_token_tree())
})
self.parse_seq_to_before_tokens(kets, &[], SeqSep::none(), |p| Ok(p.parse_token_tree()))
{
err.cancel();
}