MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Tokens

Function Tokens

postgres/parser/parser/scan.go:1037–1051  ·  view source on GitHub ↗

Tokens decomposes the input into lexical tokens.

(sql string)

Source from the content-addressed store, hash-verified

1035
1036// Tokens decomposes the input into lexical tokens.
1037func Tokens(sql string) (tokens []TokenString, ok bool) {
1038 s := makeScanner(sql)
1039 for {
1040 var lval sqlSymType
1041 s.scan(&lval)
1042 if lval.id == ERROR {
1043 return nil, false
1044 }
1045 if lval.id == 0 {
1046 break
1047 }
1048 tokens = append(tokens, TokenString{TokenID: lval.id, Str: lval.str})
1049 }
1050 return tokens, true
1051}
1052
1053// TokenString is the unit value returned by Tokens.
1054type TokenString struct {

Callers

nothing calls this directly

Calls 2

makeScannerFunction · 0.85
scanMethod · 0.80

Tested by

no test coverage detected