diff --git a/go.mod b/go.mod index ca9182f..1ad02e7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module asciigoat.org/ini go 1.19 require ( - asciigoat.org/core v0.3.7 + asciigoat.org/core v0.3.9 github.com/mgechev/revive v1.3.3 golang.org/x/tools v0.12.0 ) diff --git a/go.sum b/go.sum index 5125985..6570a2f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -asciigoat.org/core v0.3.7 h1:tMasdvZgsMJJMVsZVfXXB5lqq82pFiCsyEmOEmcmAfI= -asciigoat.org/core v0.3.7/go.mod h1:tXj+JUutxRbcO40ZQRuUVaZ4rnYz1kAZ0nblisV8u74= +asciigoat.org/core v0.3.9 h1:hgDDz4ecm3ZvehX++m8A/IzAt+B5oDPiRtxatzfUHPQ= +asciigoat.org/core v0.3.9/go.mod h1:CAaHwyw8MpAq4a1MYtN2dxJrsK+hmIdW50OndaQZYPI= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= diff --git a/parser/text.go b/parser/text.go index 84454eb..b1bf0ae 100644 --- a/parser/text.go +++ b/parser/text.go @@ -39,9 +39,10 @@ func (p *TextParser) InitString(s string) { // Discard shadows [lexer.Reader]'s, and takes in consideration // new lines on the discarded data when moving the position -func (*TextParser) Discard() { - // TODO: consider new lines - panic("not implemented") +func (p *TextParser) Discard() { + s := p.Reader.Emit() + l := GetPositionalLength(s) + p.pos.Add(l) } // Emit returns the accepted text, its position, and @@ -49,8 +50,8 @@ func (*TextParser) Discard() { func (p *TextParser) Emit() (lexer.Position, string) { pos := p.pos s := p.Reader.Emit() - // TODO: consider new lines - p.pos.StepN(len(s)) + l := GetPositionalLength(s) + p.pos.Add(l) return pos, s }