diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-22 00:17:46 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-22 00:17:46 -0800 |
commit | a5f90cf8a467ac8817ab3db5c9f8190b7a547d67 (patch) | |
tree | 872f4521ff5fbf3575075a2348ee532c39ab2590 /tests/011 | |
parent | 16094ab126996e3963561b520ff22b405b56ca61 (diff) | |
download | txr-a5f90cf8a467ac8817ab3db5c9f8190b7a547d67.tar.gz txr-a5f90cf8a467ac8817ab3db5c9f8190b7a547d67.tar.bz2 txr-a5f90cf8a467ac8817ab3db5c9f8190b7a547d67.zip |
matcher: existing variables in @(all) now backref.
This commit fixes the inadequacy that all variables occurring
in a pattern under @(all ...) or @(coll ...) are blindly
collated into lists, ignoring the fact that they may be
previously bound variables that must back-reference and not be
colleced into lists (just like in the TXR Pattern language!)
* share/txr/stdlib/match.tl (compile-loop-match): Calculate
the subset of variables in the pattern that have been freshly
bound. Only generate the collection gensyms for those
variables and only collect and nreverse those variables.
* tests/011/patmatch.tl: Some test cases that backreference
into an @(all).
* txr.1: Documented.
Diffstat (limited to 'tests/011')
-rw-r--r-- | tests/011/patmatch.tl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl index 11a6a933..2b1e26c8 100644 --- a/tests/011/patmatch.tl +++ b/tests/011/patmatch.tl @@ -54,6 +54,10 @@ (list a b)) ((1 2 3) (a b c))) +(test (when-match (@x @(all @x)) '(1 (1 1 1 1)) x) 1) + +(test (when-match (@x @(all @x)) '(1 (1 1 1 2)) x) nil) + (test (when-match @(some (x @a @b)) '((y 1 a) (x 2 b) (z 3 c)) (list a b)) (2 b)) |