File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -511,13 +511,15 @@ impl<'a> Parser<'a> {
511
511
is_present
512
512
}
513
513
514
+ /// If the next token is the given keyword, returns `true` without eating it.
515
+ /// An expectation is also added for diagnostics purposes.
514
516
fn check_keyword ( & mut self , kw : Symbol ) -> bool {
515
517
self . expected_tokens . push ( TokenType :: Keyword ( kw) ) ;
516
518
self . token . is_keyword ( kw)
517
519
}
518
520
519
- /// If the next token is the given keyword, eats it and returns
520
- /// `true`. Otherwise, returns `false`.
521
+ /// If the next token is the given keyword, eats it and returns `true`.
522
+ /// Otherwise, returns `false`. An expectation is also added for diagnostics purposes .
521
523
pub fn eat_keyword ( & mut self , kw : Symbol ) -> bool {
522
524
if self . check_keyword ( kw) {
523
525
self . bump ( ) ;
@@ -896,6 +898,8 @@ impl<'a> Parser<'a> {
896
898
self . expected_tokens . clear ( ) ;
897
899
}
898
900
901
+ /// Look-ahead `dist` tokens of `self.token` and get access to that token there.
902
+ /// When `dist == 0` then the current token is looked at.
899
903
pub fn look_ahead < R > ( & self , dist : usize , looker : impl FnOnce ( & Token ) -> R ) -> R {
900
904
if dist == 0 {
901
905
return looker ( & self . token ) ;
You can’t perform that action at this time.
0 commit comments