diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-20 22:59:02 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-20 22:59:02 -0800 |
commit | 947b0979d05b190fee65698864cd1e14b5797f66 (patch) | |
tree | 1e5e93f7e4ba5c69d0bb3815c2eeb30904a74fd7 /tests/017/glob-carray.tl | |
parent | d30af5639c1a3a27452a7cd63c6f91201eac687b (diff) | |
download | txr-947b0979d05b190fee65698864cd1e14b5797f66.tar.gz txr-947b0979d05b190fee65698864cd1e14b5797f66.tar.bz2 txr-947b0979d05b190fee65698864cd1e14b5797f66.zip |
matcher: allow variables to back-reference.
Multiple occurrences of variables unify using equal.
* share/txr/stdlib/match.tl (var-list): New struct type.
Used for tracking what variables have been defined.
(compile-struct-match, compile-vec-match, compile-atom-match,
compile-op-match, compile-cons-structure,
compile-require-match, compile-let-match, compile-loop-match,
compile-parallel-match, compile-not-match): Take var-match
argument and pass it down.
(compile-parallel-match): Take var-match argument and pass
copies of it down to the compile jobs of the branches, since
they do not unify.
(compile-var-match, comiple-let-match, compile-op-match):
Handle variables carefully: check for variable already
being defined and generate a backreference instead of
a new binding match.
(compile-match): Take optional var-list argument,
instantiating the object if it is missing, pass down to all
recursive compile unctions.
* txr.1: Documented.
Diffstat (limited to 'tests/017/glob-carray.tl')
0 files changed, 0 insertions, 0 deletions