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

Function LastLexicalToken

pkg/sql/parser/scan.go:1005–1015  ·  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

1003// LastLexicalToken returns the last lexical token. If the string has no lexical
1004// tokens, returns 0 and ok=false.
1005func LastLexicalToken(sql string) (lastTok int, ok bool) {
1006 s := makeScanner(sql)
1007 var lval sqlSymType
1008 for {
1009 last := lval.id
1010 s.scan(&lval)
1011 if lval.id == 0 {
1012 return int(last), last != 0
1013 }
1014 }
1015}
1016
1017// EndsInSemicolon returns true if the last lexical token is a semicolon.
1018func EndsInSemicolon(sql string) bool {

Callers 1

EndsInSemicolonFunction · 0.85

Calls 2

makeScannerFunction · 0.85
scanMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…