diff --git a/parser/parser_test.go b/parser/parser_test.go index 2c64ce52..2ec0e7e6 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -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 { diff --git a/scanner/context.go b/scanner/context.go index 5f92a6ef..b5ffabbc 100644 --- a/scanner/context.go +++ b/scanner/context.go @@ -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 {