fixed column indexing
This commit is contained in:
parent
9d4da8ef95
commit
5897251193
@ -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++
|
||||
}
|
||||
|
@ -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},
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user