diff --git a/reader.go b/reader.go index 1797096..d9379ca 100644 --- a/reader.go +++ b/reader.go @@ -33,8 +33,8 @@ func (r *Reader) psrn(rn rune) posRune { } } -func (r *Reader) Pos() (index, line, column int) { - return r.pos.Index, r.pos.Line, r.pos.Column +func (r *Reader) Pos() Position { + return *r.pos } // Rune returns the next rune in r diff --git a/reader_test.go b/reader_test.go index 09401de..e5a0021 100644 --- a/reader_test.go +++ b/reader_test.go @@ -11,8 +11,8 @@ func TestPos(t *testing.T) { unread := false for rn, err := r.Rune(); err == nil; rn, err = r.Rune() { - index, line, col := r.Pos() - fmt.Println(string(rn), index, line, col) + pos := r.Pos() + fmt.Println(string(rn), pos.Index, pos.Line, pos.Column) if !unread && rn == '\n' { for i := 0; i < 5; i++ {