From 94914448e5c830216c74616ad11351e3154cd005 Mon Sep 17 00:00:00 2001 From: semihbkgr Date: Mon, 28 Oct 2024 15:26:12 +0300 Subject: [PATCH 1/2] fix isNextEOS method in scanner context --- scanner/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From bd078f05fb3270328c616587495714ada0b3f17a Mon Sep 17 00:00:00 2001 From: semihbkgr Date: Mon, 28 Oct 2024 17:08:29 +0300 Subject: [PATCH 2/2] adding unit test --- parser/parser_test.go | 1 + 1 file changed, 1 insertion(+) 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 {