MCPcopy Create free account
hub / github.com/bytebase/bytebase / caretInsideBacktickIdentifier

Function caretInsideBacktickIdentifier

backend/plugin/parser/tidb/completion.go:418–430  ·  view source on GitHub ↗
(statement string, pos int)

Source from the content-addressed store, hash-verified

416}
417
418func caretInsideBacktickIdentifier(statement string, pos int) bool {
419 if pos > len(statement) {
420 pos = len(statement)
421 }
422 masked := stripStringsAndComments(statement)
423 count := 0
424 for i := 0; i < pos; i++ {
425 if masked[i] == '`' {
426 count++
427 }
428 }
429 return count%2 == 1
430}
431
432// stripStringsAndComments returns statement with the contents of string literals
433// ('...', "..."), line comments (-- , #), and block comments (/* */) replaced by

Callers 2

CompletionFunction · 0.85

Calls 1

stripStringsAndCommentsFunction · 0.85

Tested by 1