diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-04-21 06:54:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-04-21 06:54:50 -0700 |
commit | 9b8fce5acc9f27866b29ececbece109bbdef01f0 (patch) | |
tree | 42361acae0c1a91cc75746230c8b5592780a196c /tests/011/special-1.tl | |
parent | 43e0e33ced93434fd32c050ab3ca68a1e7231932 (diff) | |
download | txr-9b8fce5acc9f27866b29ececbece109bbdef01f0.tar.gz txr-9b8fce5acc9f27866b29ececbece109bbdef01f0.tar.bz2 txr-9b8fce5acc9f27866b29ececbece109bbdef01f0.zip |
matcher: defmatch: useful :env parameter.
* share/txr/stdlib/match.tl (compile-match): Pattern macro
expanders now have an environment parameter. We turn the list
of variables that have been bound so far into a fake
macro-time lexical environment, the parent of which is the
surrounding environment. The pattern macro can query this
using the lexical-var-p function to determine whether a given
variable already has a binding, either in the pattern, or
in the surrounding lexical environment.
(defmatch): Generate a two-argument lambda, and use the new
mac-env-param-bind to make the environment object available
to the user-defined expansion.
* tests/011/patmatch.tl: New test cases for this environment
mechanism, and also for defmatch itself.
* txr.1: Document role of :env under defmatch.
Diffstat (limited to 'tests/011/special-1.tl')
0 files changed, 0 insertions, 0 deletions