(intern bool)
| 5793 | } |
| 5794 | |
| 5795 | func (p *Parser) parseLiteralExpression(intern bool) *ast.Node { |
| 5796 | pos := p.nodePos() |
| 5797 | text := p.scanner.TokenValue() |
| 5798 | if intern { |
| 5799 | text = p.internIdentifier(text) |
| 5800 | } |
| 5801 | tokenFlags := p.scanner.TokenFlags() |
| 5802 | var result *ast.Node |
| 5803 | switch p.token { |
| 5804 | case ast.KindStringLiteral: |
| 5805 | result = p.factory.NewStringLiteral(text, tokenFlags) |
| 5806 | case ast.KindNumericLiteral: |
| 5807 | result = p.factory.NewNumericLiteral(text, tokenFlags) |
| 5808 | case ast.KindBigIntLiteral: |
| 5809 | result = p.factory.NewBigIntLiteral(text, tokenFlags) |
| 5810 | case ast.KindRegularExpressionLiteral: |
| 5811 | result = p.factory.NewRegularExpressionLiteral(text, tokenFlags) |
| 5812 | case ast.KindNoSubstitutionTemplateLiteral: |
| 5813 | result = p.factory.NewNoSubstitutionTemplateLiteral(text, tokenFlags) |
| 5814 | default: |
| 5815 | panic("Unhandled case in parseLiteralExpression") |
| 5816 | } |
| 5817 | p.nextToken() |
| 5818 | return p.finishNode(result, pos) |
| 5819 | } |
| 5820 | |
| 5821 | func (p *Parser) parseIdentifierNameErrorOnUnicodeEscapeSequence() *ast.Node { |
| 5822 | if p.scanner.HasUnicodeEscape() || p.scanner.HasExtendedUnicodeEscape() { |
no test coverage detected