diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-04-13 21:56:12 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-04-13 21:56:12 -0700 |
commit | 0e3992bb2c96fea651067698572f855949ebe6f5 (patch) | |
tree | 966d7f15eaa860654de3d07c941eb2c4b372f48e | |
parent | a18d36971c7cb68fc14f44005b83cf86d9c74e23 (diff) | |
download | txr-0e3992bb2c96fea651067698572f855949ebe6f5.tar.gz txr-0e3992bb2c96fea651067698572f855949ebe6f5.tar.bz2 txr-0e3992bb2c96fea651067698572f855949ebe6f5.zip |
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.
-rw-r--r-- | match.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; } |