summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-08-17 22:56:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-08-17 22:56:26 -0700
commit7f17d9b257eee0b2848a4fbb83b12ea142c454b0 (patch)
treecc900f07d22c5f5751c2a912f7821312de79a300 /parser.y
parent8f03981dfcd66aed76a98716e1a41a8bf1f0dbe6 (diff)
downloadtxr-7f17d9b257eee0b2848a4fbb83b12ea142c454b0.tar.gz
txr-7f17d9b257eee0b2848a4fbb83b12ea142c454b0.tar.bz2
txr-7f17d9b257eee0b2848a4fbb83b12ea142c454b0.zip
txr: repeat ferrets out Lisp-embedded vars.
Gone is the need for :vars to inform @(repeat)/@(rep) about variable references buried in Lisp. * eval.c (expand_with_free_refs): Change to external linkage. * eval.h (expand_with_free_refs): Declared. * parser.y (extract_vars): Handle sys:expr forms, which are embedded Lisp via expand_with_free_refs to uncover their free variables. * txr.1: Redocumented this area.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/parser.y b/parser.y
index d829b4f7..409400f0 100644
--- a/parser.y
+++ b/parser.y
@@ -1519,7 +1519,11 @@ static val extract_vars(val output_spec)
}
}
}
- } else if (sym != expr_s) {
+ } else if (sym == expr_s) {
+ val expr = second(output_spec);
+ val frefs = expand_with_free_refs(expr, nil, nil);
+ tai = list_collect_nconc(tai, second(frefs));
+ } else {
for (; output_spec; output_spec = cdr(output_spec))
tai = list_collect_nconc(tai, extract_vars(car(output_spec)));
}