aboutsummaryrefslogtreecommitdiffstats
path: root/lexer.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-11-22 08:26:09 -0800
committerRose Hogenson <rosehogenson@posteo.net>2025-11-22 08:26:09 -0800
commitda798b651e8efc766cf66a39ccef906681f0b17a (patch)
tree6adca8b604745ec729b88b8253840a4e82541d59 /lexer.go
parentHoly shit fuzzing is so cool (diff)
downloadccl-da798b651e8efc766cf66a39ccef906681f0b17a.tar.zst
Improve error handling
Diffstat (limited to 'lexer.go')
-rw-r--r--lexer.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/lexer.go b/lexer.go
index e2680e8..0b54de3 100644
--- a/lexer.go
+++ b/lexer.go
@@ -2,7 +2,6 @@ package ccl
import (
"bytes"
- "fmt"
"unicode"
"unicode/utf8"
)
@@ -36,13 +35,13 @@ Space:
continue
}
if bytes.HasPrefix(l.data[l.i:], []byte("/*")) {
- for ; l.i < len(l.data); l.i++ {
- if bytes.HasPrefix(l.data[l.i:], []byte("*/")) {
- l.i += 2
+ for i := l.i; i < len(l.data); i++ {
+ if bytes.HasPrefix(l.data[i:], []byte("*/")) {
+ l.i = i + 2
continue Space
}
}
- return fmt.Errorf("unterminated comment")
+ return l.error("unterminated comment")
}
if r, n := utf8.DecodeRune(l.data[l.i:]); unicode.IsSpace(r) {
l.i += n