summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-01-22 06:06:26 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-01-22 06:06:26 -0800
commit2d4678796576de8ac362f009df6d44a6ae392853 (patch)
tree7589c62581f76757860272139c7424929d3dedf9
parent9edd914a456121aac8cc59cbcb9764038bb98bd7 (diff)
downloadtxr-2d4678796576de8ac362f009df6d44a6ae392853.tar.gz
txr-2d4678796576de8ac362f009df6d44a6ae392853.tar.bz2
txr-2d4678796576de8ac362f009df6d44a6ae392853.zip
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.)
-rw-r--r--parser.y18
1 files 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;