commit cbb609508a7e3f062b59eb03525cb5318be05613
parent b64a5de6cc857e39f424578b756275559cd22f2f
Author: Lou Woell <lou.woell@posteo.de>
Date:   Tue, 16 Sep 2025 01:30:26 +0200

[resolve] handle trailing ::

Diffstat:
Mcmd/harehelper/resolve.ha | 12++++++------
Mcmd/harehelper/util.ha | 5+++--
2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/cmd/harehelper/resolve.ha b/cmd/harehelper/resolve.ha @@ -28,9 +28,9 @@ fn resolve(cmd: getopt::command, ctx: *module::context) void = { if (len(cmd.args) == 0) fmt::fatal("Expected Argument"); - let id = match (parse::identstr(cmd.args[0])) { - case let id: ast::ident => - yield id; + let (id, trailing) = match (identstr_trailing(cmd.args[0])) { + case let res: (ast::ident, bool) => + yield res; case let e: parse::error => return void; }; @@ -39,16 +39,16 @@ fn resolve(cmd: getopt::command, ctx: *module::context) void = { let file = if (len(cmd.args) > 1) { yield cmd.args[1]; } else { - printident(id); + printident(id, trailing); return void; }; match (resolve_uid(ctx, id, file)) { case let id_exp: ast::ident => - printident(id_exp); + printident(id_exp, trailing); ast::ident_free(id_exp); case => - printident(id); + printident(id, trailing); }; }; diff --git a/cmd/harehelper/util.ha b/cmd/harehelper/util.ha @@ -28,9 +28,10 @@ use strings; def HAREPATH = "."; -fn printident(i: ast::ident) void = { +fn printident(i: ast::ident, trailing: bool = false) void = { unparse::ident(os::stdout, i)!; - fmt::println()!; + let trail = if (trailing) "::" else ""; + fmt::println(trail)!; }; fn ident_last(id: ast::ident) ast::ident = {