(type: TokenType)
| 69 | } |
| 70 | |
| 71 | private next(type: TokenType): Token | null { |
| 72 | if (this.currentToken == null) { |
| 73 | return null; |
| 74 | } |
| 75 | if (this.currentToken.type === type) { |
| 76 | this.currentToken = this.lexer.getNextToken(); |
| 77 | } else { |
| 78 | switch (type) { |
| 79 | case TokenType.LeftParen: |
| 80 | throw new SyntaxError(t(Strings.function_err_no_left_bracket)); |
| 81 | case TokenType.RightParen: |
| 82 | throw new SyntaxError(t(Strings.function_err_end_of_right_bracket)); |
| 83 | } |
| 84 | throw new SyntaxError(t(Strings.function_err_unable_parse_char, { |
| 85 | value: this.currentToken.value, |
| 86 | })); |
| 87 | } |
| 88 | return this.currentToken; |
| 89 | } |
| 90 | |
| 91 | private factor(): AstNode { |
| 92 | // factor : VALUE | LEFT_PAREN expr RIGHT_PAREN | NOT expr |
no test coverage detected