* If the next token is a given keyword, advance the lexer. * Otherwise, do not change the parser state and throw an error.
(value)
| 3120 | * Otherwise, do not change the parser state and throw an error. |
| 3121 | */ |
| 3122 | expectKeyword(value) { |
| 3123 | const token = this._lexer.token; |
| 3124 | if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { |
| 3125 | this.advanceLexer(); |
| 3126 | } else { |
| 3127 | throw (0, _syntaxError.syntaxError)( |
| 3128 | this._lexer.source, |
| 3129 | token.start, |
| 3130 | `Expected "${value}", found ${getTokenDesc(token)}.` |
| 3131 | ); |
| 3132 | } |
| 3133 | } |
| 3134 | /** |
| 3135 | * If the next token is a given keyword, return "true" after advancing the lexer. |
| 3136 | * Otherwise, do not change the parser state and return "false". |
no test coverage detected