@@ -141,7 +141,7 @@ pub struct Parser<'a> {
141
141
pub prev_token : Token ,
142
142
pub capture_cfg : bool ,
143
143
restrictions : Restrictions ,
144
- expected_tokens : Vec < TokenType > ,
144
+ expected_token_types : Vec < TokenType > ,
145
145
token_cursor : TokenCursor ,
146
146
// The number of calls to `bump`, i.e. the position in the token stream.
147
147
num_bump_calls : u32 ,
@@ -490,7 +490,7 @@ impl<'a> Parser<'a> {
490
490
prev_token : Token :: dummy ( ) ,
491
491
capture_cfg : false ,
492
492
restrictions : Restrictions :: empty ( ) ,
493
- expected_tokens : Vec :: new ( ) ,
493
+ expected_token_types : Vec :: new ( ) ,
494
494
token_cursor : TokenCursor { curr : TokenTreeCursor :: new ( stream) , stack : Vec :: new ( ) } ,
495
495
num_bump_calls : 0 ,
496
496
break_last_token : 0 ,
@@ -554,7 +554,7 @@ impl<'a> Parser<'a> {
554
554
555
555
/// Expects and consumes the token `t`. Signals an error if the next token is not `t`.
556
556
pub fn expect ( & mut self , t : & TokenKind ) -> PResult < ' a , Recovered > {
557
- if self . expected_tokens . is_empty ( ) {
557
+ if self . expected_token_types . is_empty ( ) {
558
558
if self . token == * t {
559
559
self . bump ( ) ;
560
560
Ok ( Recovered :: No )
@@ -619,13 +619,13 @@ impl<'a> Parser<'a> {
619
619
620
620
/// Checks if the next token is `tok`, and returns `true` if so.
621
621
///
622
- /// This method will automatically add `tok` to `expected_tokens ` if `tok` is not
622
+ /// This method will automatically add `tok` to `expected_token_types ` if `tok` is not
623
623
/// encountered.
624
624
#[ inline]
625
625
fn check ( & mut self , tok : & TokenKind ) -> bool {
626
626
let is_present = self . token == * tok;
627
627
if !is_present {
628
- self . expected_tokens . push ( TokenType :: Token ( tok. clone ( ) ) ) ;
628
+ self . expected_token_types . push ( TokenType :: Token ( tok. clone ( ) ) ) ;
629
629
}
630
630
is_present
631
631
}
@@ -666,7 +666,7 @@ impl<'a> Parser<'a> {
666
666
#[ inline]
667
667
#[ must_use]
668
668
fn check_keyword ( & mut self , kw : Symbol ) -> bool {
669
- self . expected_tokens . push ( TokenType :: Keyword ( kw) ) ;
669
+ self . expected_token_types . push ( TokenType :: Keyword ( kw) ) ;
670
670
self . token . is_keyword ( kw)
671
671
}
672
672
@@ -755,7 +755,7 @@ impl<'a> Parser<'a> {
755
755
if ok {
756
756
true
757
757
} else {
758
- self . expected_tokens . push ( typ) ;
758
+ self . expected_token_types . push ( typ) ;
759
759
false
760
760
}
761
761
}
@@ -832,7 +832,7 @@ impl<'a> Parser<'a> {
832
832
true
833
833
}
834
834
_ => {
835
- self . expected_tokens . push ( TokenType :: Token ( expected) ) ;
835
+ self . expected_token_types . push ( TokenType :: Token ( expected) ) ;
836
836
false
837
837
}
838
838
}
@@ -1180,7 +1180,7 @@ impl<'a> Parser<'a> {
1180
1180
self . token_spacing = next_spacing;
1181
1181
1182
1182
// Diagnostics.
1183
- self . expected_tokens . clear ( ) ;
1183
+ self . expected_token_types . clear ( ) ;
1184
1184
}
1185
1185
1186
1186
/// Advance the parser by one token.
@@ -1670,8 +1670,8 @@ impl<'a> Parser<'a> {
1670
1670
DebugParser { parser : self , lookahead }
1671
1671
}
1672
1672
1673
- pub fn clear_expected_tokens ( & mut self ) {
1674
- self . expected_tokens . clear ( ) ;
1673
+ pub fn clear_expected_token_types ( & mut self ) {
1674
+ self . expected_token_types . clear ( ) ;
1675
1675
}
1676
1676
1677
1677
pub fn approx_token_stream_pos ( & self ) -> u32 {
0 commit comments