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

Method getColumnAt

backend/plugin/parser/tokenizer/tokenizer.go:745–752  ·  view source on GitHub ↗

getColumnAt returns the 1-based column position at a specific rune position.

(pos uint)

Source from the content-addressed store, hash-verified

743
744// getColumnAt returns the 1-based column position at a specific rune position.
745func (t *Tokenizer) getColumnAt(pos uint) int {
746 for i := int(pos) - 1; i >= 0; i-- {
747 if t.buffer[i] == '\n' {
748 return int(pos) - i // 1-based: first char after newline is column 1
749 }
750 }
751 return int(pos) + 1 // 1-based: first char of first line is column 1
752}
753
754// getLastContentColumn returns the 1-based column after the last non-blank character.
755// Used for EOF case where we need exclusive end position.

Callers 2

getColumnMethod · 0.95
getLastContentColumnMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected