fixed column indexing
This commit is contained in:
parent
9d4da8ef95
commit
5897251193
@ -10,7 +10,7 @@ func (p *Position) Advance(rn rune) {
|
|||||||
p.Index++
|
p.Index++
|
||||||
if rn == '\n' {
|
if rn == '\n' {
|
||||||
p.Line++
|
p.Line++
|
||||||
p.Column = 0
|
p.Column = 1
|
||||||
} else {
|
} else {
|
||||||
p.Column++
|
p.Column++
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ func New(r io.Reader) *Reader {
|
|||||||
return &Reader{
|
return &Reader{
|
||||||
buf: ds.NewArrayStack[posRune](),
|
buf: ds.NewArrayStack[posRune](),
|
||||||
src: bufio.NewReader(r),
|
src: bufio.NewReader(r),
|
||||||
pos: &Position{Index: 0, Line: 1, Column: 0},
|
pos: &Position{Index: 0, Line: 1, Column: 1},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user