()
| 802 | } |
| 803 | |
| 804 | private parseTupleItem(): LiteralValue { |
| 805 | const fall = this.fallThrough(); |
| 806 | if (fall) { |
| 807 | return fall; |
| 808 | } |
| 809 | const token = this.peek(); |
| 810 | switch (token.type) { |
| 811 | case TokenType.STRING: |
| 812 | return this.parseStringLiteral(); |
| 813 | case TokenType.NUMBER: |
| 814 | return this.parseNumberLiteral(); |
| 815 | case TokenType.IDENTIFIER: |
| 816 | return this.parseIdentifierLiteral(); |
| 817 | case TokenType.DOLLAR: |
| 818 | return this.parseVariableReference(); |
| 819 | default: |
| 820 | throw new ParserError( |
| 821 | `Invalid value inside tuple: ${token.type}`, |
| 822 | token.position |
| 823 | ); |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | private parseStringLiteral(): StringLiteral { |
| 828 | const token = this.consume(TokenType.STRING, "Expected string literal"); |
no test coverage detected