MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / LastLexicalToken

Function LastLexicalToken

pkg/sql/scanner/scan.go:1165–1176  ·  view source on GitHub ↗

LastLexicalToken returns the last lexical token. If the string has no lexical tokens, returns 0 and ok=false.

(sql string)

Source from the content-addressed store, hash-verified

1163// LastLexicalToken returns the last lexical token. If the string has no lexical
1164// tokens, returns 0 and ok=false.
1165func LastLexicalToken(sql string) (lastTok int, ok bool) {
1166 var s SQLScanner
1167 var lval fakeSym
1168 s.Init(sql)
1169 for {
1170 last := lval.ID()
1171 s.Scan(&lval)
1172 if lval.ID() == 0 {
1173 return int(last), last != 0
1174 }
1175 }
1176}
1177
1178// FirstLexicalToken returns the first lexical token.
1179// Returns 0 if there is no token.

Callers

nothing calls this directly

Calls 3

IDMethod · 0.95
ScanMethod · 0.95
InitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…