diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-10-01 06:09:24 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-10-01 06:09:24 -0700 |
commit | 856616ca9fbc158073e8f2a67edd92db151bfce1 (patch) | |
tree | 9c377dc486d63556c0199dcab5bc274240828408 | |
parent | 0b876b42caf102c20d595b343ae60a71b9048eb9 (diff) | |
download | txr-856616ca9fbc158073e8f2a67edd92db151bfce1.tar.gz txr-856616ca9fbc158073e8f2a67edd92db151bfce1.tar.bz2 txr-856616ca9fbc158073e8f2a67edd92db151bfce1.zip |
txr: bugfix: repeat not finding Lisp vars in brace.
The following does not work and is fixed here:
@(output)
@(repeat)
@{lisp-expr ...}
@(end)
When a Lisp expression occurs in a braced expansion
syntax, it is not not traversed to find variables.
* parser.y (extract_vars): Treat the second element of a
sys:var as a Lisp expression, and find variables. Don't do
this in 128 or older compatibility mode, because then that is
a TXR expression.
* y.tab.c.shipped: Regenerated.
-rw-r--r-- | parser.y | 14 | ||||
-rw-r--r-- | y.tab.c.shipped | 14 |
2 files changed, 18 insertions, 10 deletions
@@ -1488,13 +1488,17 @@ static val extract_vars(val output_spec) if (consp(output_spec)) { val sym = first(output_spec); if (sym == var_s) { - val name = second(output_spec); + val expr = second(output_spec); val modifiers = third(output_spec); - if (bindable(name)) - tai = list_collect(tai, name); - else - tai = list_collect_nconc(tai, extract_vars(name)); + if (bindable(expr)) { + tai = list_collect(tai, expr); + } else if (opt_compat && opt_compat <= 128) { + tai = list_collect_nconc(tai, extract_vars(expr)); + } else { + val frefs = expand_with_free_refs(expr, nil, nil); + tai = list_collect_nconc(tai, second(frefs)); + } for (; modifiers; modifiers = cdr(modifiers)) { val mod = car(modifiers); diff --git a/y.tab.c.shipped b/y.tab.c.shipped index 2345cb9a..a148a9b3 100644 --- a/y.tab.c.shipped +++ b/y.tab.c.shipped @@ -6767,13 +6767,17 @@ static val extract_vars(val output_spec) if (consp(output_spec)) { val sym = first(output_spec); if (sym == var_s) { - val name = second(output_spec); + val expr = second(output_spec); val modifiers = third(output_spec); - if (bindable(name)) - tai = list_collect(tai, name); - else - tai = list_collect_nconc(tai, extract_vars(name)); + if (bindable(expr)) { + tai = list_collect(tai, expr); + } else if (opt_compat && opt_compat <= 128) { + tai = list_collect_nconc(tai, extract_vars(expr)); + } else { + val frefs = expand_with_free_refs(expr, nil, nil); + tai = list_collect_nconc(tai, second(frefs)); + } for (; modifiers; modifiers = cdr(modifiers)) { val mod = car(modifiers); |