bufr/position.go

18 lines
196 B
Go
Raw Permalink Normal View History

2022-05-23 12:59:35 +02:00
package bufr
type Position struct {
Index int
Line int
Column int
}
func (p *Position) Advance(rn rune) {
p.Index++
if rn == '\n' {
p.Line++
2023-03-18 23:10:22 +01:00
p.Column = 1
2022-05-23 12:59:35 +02:00
} else {
p.Column++
}
}