hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 6365cdae2b19c6f5aa6ccdd5b6223ae5523314ac
parent 5729444a930ad7c90283e4cad29f221f322f7f33
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu, 30 May 2024 11:07:55 +0200

regex: use bufio::scanner for enumerating runes

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mregex/regex.ha | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/regex/regex.ha b/regex/regex.ha @@ -679,6 +679,8 @@ fn search( let str_bytesize = 0z; let last_bytesize = 0z; + const scan = bufio::newscanner(handle); + defer bufio::finish(&scan); for (true) { str_bytesize += last_bytesize; @@ -718,7 +720,7 @@ fn search( return res; }; - const r_or_end = bufio::read_rune(handle)!; + const r_or_end = bufio::scan_rune(&scan)!; if (r_or_end is rune) { last_bytesize = utf8::runesz(r_or_end as rune); };