MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / parseNumericLit

Method parseNumericLit

pkg/sql/parser/mariadb.go:249–260  ·  view source on GitHub ↗

parseNumericLit reads a numeric literal token and returns a LiteralValue.

()

Source from the content-addressed store, hash-verified

247
248// parseNumericLit reads a numeric literal token and returns a LiteralValue.
249func (p *Parser) parseNumericLit() (*ast.LiteralValue, error) {
250 if !p.isNumericLiteral() {
251 return nil, p.expectedError("numeric literal")
252 }
253 value := p.currentToken.Token.Value
254 litType := "int"
255 if strings.ContainsAny(value, ".eE") {
256 litType = "float"
257 }
258 p.advance()
259 return &ast.LiteralValue{Value: value, Type: litType}, nil
260}
261
262// parseForSystemTimeClause parses the FOR SYSTEM_TIME clause that follows a table reference.
263// The caller has already consumed FOR.

Callers 1

parseSequenceOptionsMethod · 0.95

Calls 3

isNumericLiteralMethod · 0.95
expectedErrorMethod · 0.95
advanceMethod · 0.95

Tested by

no test coverage detected