Skip to content

Commit

Permalink
Fix incorrect colon indicator scanning (#485)
Browse files Browse the repository at this point in the history
* fix isNextEOS method in scanner context

* adding unit test
  • Loading branch information
semihbkgr authored Oct 28, 2024
1 parent 548bbc7 commit c7e80a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func TestParser(t *testing.T) {
"a: \r\n b: 1\r\n",
"a_ok: \r bc: 2\r",
"a_mk: \n bd: 3\n",
"a: :a",
}
for _, src := range sources {
if _, err := parser.Parse(lexer.Tokenize(src), 0); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion scanner/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (c *Context) isEOS() bool {
}

func (c *Context) isNextEOS() bool {
return len(c.src)-1 <= c.idx+1
return len(c.src) <= c.idx+1
}

func (c *Context) next() bool {
Expand Down

0 comments on commit c7e80a3

Please sign in to comment.