diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-06-15 07:58:43 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-06-15 07:58:43 -0700 |
commit | ca118fac3a97a6cd6b9342d301b3b06c515ad5f1 (patch) | |
tree | b9a08668bc2fee299886e9182a4827d98ec5a30f /arith.c | |
parent | 5a584a973b632f28edcc0312d92e4a38ee567d8c (diff) | |
download | txr-ca118fac3a97a6cd6b9342d301b3b06c515ad5f1.tar.gz txr-ca118fac3a97a6cd6b9342d301b3b06c515ad5f1.tar.bz2 txr-ca118fac3a97a6cd6b9342d301b3b06c515ad5f1.zip |
expander: bug: atoms in quasiliteral.
Via macros, atoms can sneak into a quasiliteral which then
blow up because they get treated as strings without being
converted.
Example:
(defmacro two () 2)
`@(two)xyz` -> ;; error
The expansion produces the invalid form, in which the 2
is subsequently treated as a string.
(sys:quasi 2 "xyz")
On the other hand, symbol macros don't have this problem:
(defsymacro two 2)
`@{two}xyz` -> "2xyz"
The reason is that the (sys:var two) syntax will expand to
(sys:var 2), and not 2.
The straightforward, consistent fix is to ensure that the
first case will also go to (sys:var 2).
* eval.c (expand_quasi): If the expanded form is an atom which
is not a bindable symbol, wrap it in a sys:var.
* tests/012/quasi.tl: Test cases added.
Also adding a compilation test for this file, cribbed from
patmatch.tl.
Diffstat (limited to 'arith.c')
0 files changed, 0 insertions, 0 deletions