getColumnAt returns the 1-based column position at a specific rune position.
(pos uint)
| 743 | |
| 744 | // getColumnAt returns the 1-based column position at a specific rune position. |
| 745 | func (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. |
no outgoing calls
no test coverage detected