Repository: goccy/go-yaml (go)

Issue:
Incorrect colon indicator scanning
**Describe the bug**

The scanner emits a colon indicator token when a map value of type string starts with a colon and appears at the document's second-to-last index (e.g., `a: :a`). Although this is a rare case, it causes the panic described in #479. This ongoing parsing operation with these tokens leads to a panic.

**To Reproduce**
 
```go
tokens := lexer.Tokenize("a: :a")
for _, t := range tokens {
  fmt.Printf("%q %v %v\n", t.Value, t.Indicator, t.CharacterType)
}
//"a" NotIndicator Miscellaneous
//":" BlockStructure Indicator
//":" BlockStructure Indicator
//"a" NotIndicator Miscellaneous
```

**Expected behavior**

We expected to get three tokens: key + colon + value.
Instead, we received: key + colon + colon + value.

**Version Variables**
 - Go version: 1.23.2
 - go-yaml's Version: master branch



Pull request description:
Fix incorrect colon indicator scanning
fixes #484

`isNextEOS` should return `true` when the next `idx` is out of `src`

- [x] Describe the purpose for which you created this PR.  
- [ ] Create test code that corresponds to the modification

Patch:
diff --git a/scanner/context.go b/scanner/context.go
index 5f92a6e..b5ffabb 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 {


Test patch:
diff --git a/parser/parser_test.go b/parser/parser_test.go
index 2c64ce5..2ec0e7e 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 {