diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-03-04 19:47:00 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-03-04 19:47:00 -0800 |
commit | d70065204810ab34e174b727c459f00f5b015299 (patch) | |
tree | e0a12df7b478efa97b8145c664828ae711a4244b /match.c | |
parent | 333921ae04dc686b40a875d6d6633af9992d1626 (diff) | |
download | txr-d70065204810ab34e174b727c459f00f5b015299.tar.gz txr-d70065204810ab34e174b727c459f00f5b015299.tar.bz2 txr-d70065204810ab34e174b727c459f00f5b015299.zip |
bugfix: expand :counter property in @(collect).
* match.c (match_expand_keyword_args): counter is wrongly
lumped with things like :times here, which fails to handle
the syntax with an initialized like :counter (a (+ 2 2)).
We move it to a separate case.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -3073,7 +3073,7 @@ val match_expand_keyword_args(val args) if (more && (sym == maxgap_k || sym == mingap_k || sym == gap_k || sym == times_k || sym == mintimes_k || sym == maxtimes_k || - sym == lines_k || sym == counter_k || sym == vars_k || + sym == lines_k || sym == vars_k || sym == list_k || sym == string_k)) { val form = car(next); @@ -3084,6 +3084,15 @@ val match_expand_keyword_args(val args) ptail = list_collect(ptail, form_ex); args = cdr(next); } else if (more && + (sym == counter_k)) { + val form = car(next); + val vars_like_wrap = cons(form, nil); + val vars_like_ex = match_expand_vars(vars_like_wrap); + + ptail = list_collect(ptail, sym); + ptail = list_collect(ptail, car(vars_like_ex)); + args = cdr(next); + } else if (more && (sym == tlist_k)) { ptail = list_collect(ptail, sym); ptail = list_collect(ptail, expand_meta(car(next), nil)); |