From 1468f3fc7fba26345de8a67b66d4af5367c13037 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 22 Jan 2017 06:06:26 -0800 Subject: Improve accuracy of expansion of repeat/rep args. * parser.y (expand_repeat_rep_args): Correctly handle situation when :counter or :vars appears as an argument to another keyword. (A warning might be generated here, since this situation is wrong.) --- parser.y | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/parser.y b/parser.y index e1392878..9fbdbf99 100644 --- a/parser.y +++ b/parser.y @@ -1290,14 +1290,16 @@ static val expand_repeat_rep_args(val args) } else { ptail = list_collect(ptail, arg); } - } else if (arg == counter_k) { - exp_pair = t; - ptail = list_collect(ptail, arg); - continue; - } else if (arg == vars_k) { - exp_pairs = t; - ptail = list_collect(ptail, arg); - continue; + } else if (!exp_pair && !exp_pairs) { + if (arg == counter_k) { + exp_pair = t; + ptail = list_collect(ptail, arg); + continue; + } else if (arg == vars_k) { + exp_pairs = t; + ptail = list_collect(ptail, arg); + continue; + } } exp_pair = exp_pairs = nil; -- cgit v1.2.3