MCPcopy Create free account
hub / github.com/AfterShip/clickhouse-sql-parser / parseLiteral

Method parseLiteral

parser/parser_common.go:312–326  ·  view source on GitHub ↗
(pos Pos)

Source from the content-addressed store, hash-verified

310}
311
312func (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
328func (p *Parser) ParseNestedIdentifier(pos Pos) (*NestedIdentifier, error) {
329 ident, err := p.parseIdent()

Callers 6

parseRoleSettingMethod · 0.95
parseTableArgExprMethod · 0.95

Calls 6

matchTokenKindMethod · 0.95
parseNumberMethod · 0.95
parseStringMethod · 0.95
parseIdentMethod · 0.95
matchKeywordMethod · 0.95
lastTokenKindMethod · 0.95

Tested by

no test coverage detected