* If the next token is of the given kind, return that token after advancing the lexer. * Otherwise, do not change the parser state and throw an error.
(kind)
| 3092 | * Otherwise, do not change the parser state and throw an error. |
| 3093 | */ |
| 3094 | expectToken(kind) { |
| 3095 | const token = this._lexer.token; |
| 3096 | if (token.kind === kind) { |
| 3097 | this.advanceLexer(); |
| 3098 | return token; |
| 3099 | } |
| 3100 | throw (0, _syntaxError.syntaxError)( |
| 3101 | this._lexer.source, |
| 3102 | token.start, |
| 3103 | `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.` |
| 3104 | ); |
| 3105 | } |
| 3106 | /** |
| 3107 | * If the next token is of the given kind, return "true" after advancing the lexer. |
| 3108 | * Otherwise, do not change the parser state and return "false". |
no test coverage detected