(pos Pos)
| 310 | } |
| 311 | |
| 312 | func (p *Parser) parseLiteral(pos Pos) (Literal, error) { |
| 313 | switch { |
| 314 | case p.matchTokenKind(TokenKindInt), p.matchTokenKind(TokenKindFloat): |
| 315 | return p.parseNumber(pos) |
| 316 | case p.matchTokenKind(TokenKindString): |
| 317 | return p.parseString(pos) |
| 318 | case p.matchTokenKind(TokenKindIdent): |
| 319 | return p.parseIdent() |
| 320 | case p.matchKeyword(KeywordNull): |
| 321 | // accept the NULL keyword |
| 322 | return &NullLiteral{NullPos: pos}, nil |
| 323 | default: |
| 324 | return nil, fmt.Errorf("expected <int>, <string>, <ident> or keyword <NULL>, but got %q", p.lastTokenKind()) |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | func (p *Parser) ParseNestedIdentifier(pos Pos) (*NestedIdentifier, error) { |
| 329 | ident, err := p.parseIdent() |
no test coverage detected