bufio: make scanning bounded and incremental

This commit is contained in:
2026-08-09 18:17:42 +09:00
parent 09b6f22e85
commit a04de3e02b
7 changed files with 362 additions and 139 deletions

View File

@@ -23,6 +23,7 @@ package regex;
import ascii;
import bufio;
import errors;
import io;
import memio;
import strconv;
@@ -1209,7 +1210,7 @@ fn search(
// Unreachable: this scanner is newscanner(h, I32_MAX), so the
// can't-grow ceiling is never hit; the arm keeps the match
// total over scanrune's widened overflow surface (drain F-B).
case bufio.overflow => abort("regex: scanrune overflow");
case errors.overflow => abort("regex: scanrune overflow");
};
if (r_or_end is rune) {
last_bytesize = (utf8.runesz(r_or_end as rune): size);