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

Method expectTokenKind

parser/parser_common.go:51–56  ·  view source on GitHub ↗

expectTokenKind consumes the last token if it is the given kind.

(kind TokenKind)

Source from the content-addressed store, hash-verified

49
50// expectTokenKind consumes the last token if it is the given kind.
51func (p *Parser) expectTokenKind(kind TokenKind) error {
52 if lastToken := p.tryConsumeTokenKind(kind); lastToken != nil {
53 return nil
54 }
55 return fmt.Errorf("expected the last token kind is: %s, but got %s", kind, p.lastTokenKind())
56}
57
58func (p *Parser) tryConsumeTokenKind(kind TokenKind) *Token {
59 if p.matchTokenKind(kind) {

Callers 15

parseInfixMethod · 0.95
parseTernaryExprMethod · 0.95
parseColumnCastExprMethod · 0.95
parseColumnArgListMethod · 0.95
parseFunctionParamsMethod · 0.95
parseMapLiteralMethod · 0.95
parseQueryParamMethod · 0.95
parseArrayParamsMethod · 0.95
parseComplexTypeMethod · 0.95
parseEnumTypeMethod · 0.95

Calls 2

tryConsumeTokenKindMethod · 0.95
lastTokenKindMethod · 0.95

Tested by

no test coverage detected