From 5897251193ea2870ccc62509fabfc8428fcfb5f6 Mon Sep 17 00:00:00 2001 From: milarin Date: Sat, 18 Mar 2023 23:10:22 +0100 Subject: [PATCH] fixed column indexing --- position.go | 2 +- reader.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/position.go b/position.go index 44d38ad..7e24023 100644 --- a/position.go +++ b/position.go @@ -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++ } diff --git a/reader.go b/reader.go index a973f5b..1797096 100644 --- a/reader.go +++ b/reader.go @@ -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}, } }