commit 3486a3623786dda3d718f8424d27bd60e1e829b8
parent 40ddbc9b8bb29467e4dfbf36437a65b635fd02b1
Author: Alexey Yerin <yyp@disroot.org>
Date: Thu, 5 Oct 2023 21:01:55 +0300
hare::unparse: Consider indentation and newlines part of a comment
This allows to supress comments by returning 0 from comments synfunc.
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hare/unparse/decl.ha b/hare/unparse/decl.ha
@@ -167,12 +167,12 @@ fn comment(ctx: *context, syn: *synfunc, s: str) (size | io::error) = {
break;
case let line: str =>
for (let j = 0z; j < ctx.indent; j += 1) {
- n += fmt::fprint(ctx.out, "\t")?;
+ n += syn(ctx, "\t", synkind::COMMENT)?;
ctx.linelen += 8;
};
n += syn(ctx, "//", synkind::COMMENT)?;
n += syn(ctx, line, synkind::COMMENT)?;
- n += fmt::fprintln(ctx.out)?;
+ n += syn(ctx, "\n", synkind::COMMENT)?;
ctx.linelen = 0;
};
return n;