diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-05-12 06:21:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-05-12 06:21:58 -0700 |
commit | 722a6ca9a69cdd0a463d48af5380af19fd9779fc (patch) | |
tree | a09d91f42a23473111faea7773735bc172c9fb98 /lib.c | |
parent | 151e5d5dd38015b1be948477d62bf6e8b908352e (diff) | |
download | txr-722a6ca9a69cdd0a463d48af5380af19fd9779fc.tar.gz txr-722a6ca9a69cdd0a463d48af5380af19fd9779fc.tar.bz2 txr-722a6ca9a69cdd0a463d48af5380af19fd9779fc.zip |
tree: let tree-iter be iterable via generic iteration.
* lib.c (seq_iter_init_with_info): Recognize tree_iter object,
and treat using tree iterator function.
* tests/010/tree.tl: test case for tree subrange iteration
with collect-each.
* txr.1: Updated.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -857,6 +857,16 @@ void seq_iter_init_with_info(val self, seq_iter_t *it, } } } + if (it->inf.obj->co.cls == tree_iter_s) + { + it->ui.iter = if3(support_rewind, + copy_tree_iter(it->inf.obj), + it->inf.obj); + it->ul.len = 0; + it->get = seq_iter_get_tree; + it->peek = seq_iter_peek_tree; + break; + } /* fallthrough */ default: switch (it->inf.kind) { |