summaryrefslogtreecommitdiffstats
path: root/tests/011/macros-1.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-21 06:54:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-21 06:54:50 -0700
commit9b8fce5acc9f27866b29ececbece109bbdef01f0 (patch)
tree42361acae0c1a91cc75746230c8b5592780a196c /tests/011/macros-1.txr
parent43e0e33ced93434fd32c050ab3ca68a1e7231932 (diff)
downloadtxr-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/macros-1.txr')
0 files changed, 0 insertions, 0 deletions