fixed column indexing

This commit is contained in:
milarin 2023-03-18 23:10:22 +01:00
parent 9d4da8ef95
commit 5897251193
2 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ func (p *Position) Advance(rn rune) {
p.Index++
if rn == '\n' {
p.Line++
p.Column = 0
p.Column = 1
} else {
p.Column++
}

View File

@ -18,7 +18,7 @@ func New(r io.Reader) *Reader {
return &Reader{
buf: ds.NewArrayStack[posRune](),
src: bufio.NewReader(r),
pos: &Position{Index: 0, Line: 1, Column: 0},
pos: &Position{Index: 0, Line: 1, Column: 1},
}
}