Review manual for loops in core:text/regex

This commit is contained in:
Feoramund
2024-08-05 03:49:29 -04:00
parent 14858309f0
commit 8f5b838a07
3 changed files with 8 additions and 6 deletions
+3 -1
View File
@@ -225,7 +225,7 @@ null_denotation :: proc(p: ^Parser, token: Token) -> (result: Node, err: Error)
node := new(Node_Rune_Class)
for i := 0; i < len(token.text); /**/ {
#no_bounds_check for i := 0; i < len(token.text); /**/ {
r, size := utf8.decode_rune(token.text[i:])
if i == 0 && r == '^' {
node.negating = true
@@ -298,6 +298,8 @@ null_denotation :: proc(p: ^Parser, token: Token) -> (result: Node, err: Error)
}
if .Case_Insensitive in p.flags {
// These two loops cannot be in the form of `for x in y` because
// they append to the data that they iterate over.
length := len(node.runes)
#no_bounds_check for i := 0; i < length; i += 1 {
r := node.runes[i]