bufr/position.go
2023-03-18 23:10:22 +01:00

18 lines
196 B
Go

package bufr
type Position struct {
Index int
Line int
Column int
}
func (p *Position) Advance(rn rune) {
p.Index++
if rn == '\n' {
p.Line++
p.Column = 1
} else {
p.Column++
}
}