const Symbol sym = *data;
const Value v = check_non_res_value(env, data);
if(!v || !vflag(v, vflag_valid) || (v->from->ctx && v->from->ctx->error)) {
- env_err(env, prim_pos(data),
- _("variable %s not legit at this point."), s_name(sym));
+ gwerr_basic(_("Invalid variable"), _("not legit at this point."), "did you mean:",
+ env->name, prim_pos(data), 0);
did_you_mean_nspc(v ? value_owner(env, v) : env->curr, s_name(sym));
return NULL;
}
#define MAX_NAME_LEN 16
#define CHECK_LEN(name) if(strlen(name) > MAX_NAME_LEN) return;
+#define DYM_FMT "`{/+}%s{0}`?\n"
#undef did_you_mean_nspc
ANN void did_you_mean_nspc(Nspc nspc, const char* name) {
do ressembles(&v, nspc, name);
while((nspc = nspc->parent));
for(m_uint i = 0; i < vector_size(&v); ++i)
- gw_err(_(" (did you mean '%s'?)\n"), (m_str)vector_at(&v, i));
+ gw_err(DYM_FMT, (m_str)vector_at(&v, i));
vector_release(&v);
}
do ressembles(&v, t->nspc, name);
while((t = t->info->parent) && t->nspc);
for(m_uint i = 0; i < vector_size(&v); ++i)
- gw_err(_(" (did you mean '%s'?)\n"), (m_str)vector_at(&v, i));
+ gw_err(DYM_FMT, (m_str)vector_at(&v, i));
vector_release(&v);
}