diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-11-22 08:26:09 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-11-22 08:26:09 -0800 |
| commit | da798b651e8efc766cf66a39ccef906681f0b17a (patch) | |
| tree | 6adca8b604745ec729b88b8253840a4e82541d59 /lexer.go | |
| parent | Holy shit fuzzing is so cool (diff) | |
| download | ccl-da798b651e8efc766cf66a39ccef906681f0b17a.tar.zst | |
Improve error handling
Diffstat (limited to 'lexer.go')
| -rw-r--r-- | lexer.go | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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 |
