From e42436bf67ede230612c838b0253276d98b48c72 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 13 Apr 2021 21:56:12 -0700 Subject: txr: gather: report list of missing required vars. * match.c (v_gather): Identify all required variables that are missing, and list them all in the diagnostic. --- match.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/match.c b/match.c index d95331e3..2fa61026 100644 --- a/match.c +++ b/match.c @@ -3134,19 +3134,25 @@ static val v_gather(match_files_ctx *c) if (have_vars) { val iter; + val missing = nil; for (iter = vars; iter != nil; iter = cdr(iter)) { cons_bind (var, dfl_val, car(iter)); if (!tx_lookup_var(var, c->bindings)) { if (dfl_val == noval_s) { - debuglf(specline, lit("gather failed to match some required vars"), nao); - return nil; + push(var, &missing); } else { c->bindings = acons(var, dfl_val, c->bindings); } } } + if (missing) { + debuglf(specline, lit("gather failed to match required vars ~s"), + missing, nao); + return nil; + } + debuglf(specline, lit("gather matched all required vars"), nao); return next_spec_k; } -- cgit v1.2.3