hautils

[hare] Set of POSIX utilities
Log | Files | Refs | README | LICENSE

commit 747a484e18eff22fac76e601213c75858e02c38d
parent 59b2a4e209c5f56bfbe003cd2630b3cb8285cdcc
Author: Byron Torres <b@torresjrjr.com>
Date:   Mon, 16 May 2022 04:47:31 +0100

nl: update for regex changes

Diffstat:
Mnl.ha | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/nl.ha b/nl.ha @@ -217,13 +217,13 @@ export fn utilmain() (void | main::error) = { defer { if (head_style is regex::regex) { - regex::regex_finish(&(head_style as regex::regex)); + regex::finish(&(head_style as regex::regex)); }; if (body_style is regex::regex) { - regex::regex_finish(&(body_style as regex::regex)); + regex::finish(&(body_style as regex::regex)); }; if (foot_style is regex::regex) { - regex::regex_finish(&(foot_style as regex::regex)); + regex::finish(&(foot_style as regex::regex)); }; }; @@ -331,14 +331,12 @@ fn println(line: str, s: style, ctx: *context) (void | io::error) = { case none => fmt::printf("{%}{}", " ", ctx.mod, ctx.sepblank)?; case let re: regex::regex => - match (regex::find(re, line)) { - case []regex::matchgroup => + match (regex::find(&re, line)) { + case []regex::capture => fmt::printf("{%}{}", ctx.linenum, ctx.mod, ctx.sep)?; ctx.linenum += ctx.incr; case void => fmt::printf("{%}{}", " ", ctx.mod, ctx.sepblank)?; - case let err: regex::error => - fmt::fatal("Error: regex: {}", err); }; }; fmt::println(line)?;