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> {
511511 is_present
512512 }
513513
514+ /// If the next token is the given keyword, returns `true` without eating it.
515+ /// An expectation is also added for diagnostics purposes.
514516 fn check_keyword ( & mut self , kw : Symbol ) -> bool {
515517 self . expected_tokens . push ( TokenType :: Keyword ( kw) ) ;
516518 self . token . is_keyword ( kw)
517519 }
518520
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 .
521523 pub fn eat_keyword ( & mut self , kw : Symbol ) -> bool {
522524 if self . check_keyword ( kw) {
523525 self . bump ( ) ;
@@ -896,6 +898,8 @@ impl<'a> Parser<'a> {
896898 self . expected_tokens . clear ( ) ;
897899 }
898900
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.
899903 pub fn look_ahead < R > ( & self , dist : usize , looker : impl FnOnce ( & Token ) -> R ) -> R {
900904 if dist == 0 {
901905 return looker ( & self . token ) ;
You can’t perform that action at this time.
0 commit comments