From e0ec061c71fcec495c97a336663498a218f470d7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 4 Mar 2017 19:47:00 -0800 Subject: 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. --- match.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/match.c b/match.c index 6414b0ef..37c11922 100644 --- a/match.c +++ b/match.c @@ -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); @@ -3083,6 +3083,15 @@ val match_expand_keyword_args(val args) ptail = list_collect(ptail, sym); 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); -- cgit v1.2.3