summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-08-29 05:59:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-08-29 05:59:12 -0700
commitf4490cde15518f1cc491ab31a13d25d37cb080c4 (patch)
treeb42568d0897601099927d9389ca453eea1e639da /parser.y
parentf56417ae0bf59add72c70eea9a408fcaa9cb9589 (diff)
downloadtxr-f4490cde15518f1cc491ab31a13d25d37cb080c4.tar.gz
txr-f4490cde15518f1cc491ab31a13d25d37cb080c4.tar.bz2
txr-f4490cde15518f1cc491ab31a13d25d37cb080c4.zip
Fix broken expansion in @(if) and output @(repeat).
* parser.y (if_clause, elif_clauses_opt, repeat_clause, rep_elem): Recognize argument expressions as n_exprs_opt rather than exprs_opt, so that expand_meta is not applied. They are Lisp expressions, which are broken by expand_meta. A failing test case is op syntax with @num metanum variables, e.g. @(if (foo (op bar @1.slot))).
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y10
1 files changed, 5 insertions, 5 deletions
diff --git a/parser.y b/parser.y
index 181980ba..92b489d4 100644
--- a/parser.y
+++ b/parser.y
@@ -362,7 +362,7 @@ additional_parts : END newl { $$ = nil; }
yyerr("empty or subclause"); }
;
-if_clause : IF exprs_opt ')'
+if_clause : IF n_exprs_opt ')'
newl clauses_opt
elif_clauses_opt
else_clause_opt
@@ -384,11 +384,11 @@ if_clause : IF exprs_opt ')'
$$ = cons(if_s,
nappend2(branch, nappend2(elifs, els)));
rl($$, num($1)); } }
- | IF exprs_opt ')'
+ | IF n_exprs_opt ')'
newl error { $$ = nil; yybadtok(yychar, lit("if clause")); }
;
-elif_clauses_opt : ELIF exprs_opt ')' newl
+elif_clauses_opt : ELIF n_exprs_opt ')' newl
clauses_opt
elif_clauses_opt { if (opt_compat && opt_compat <= 136)
{ val req = rlcp(cons(require_s, $2), $2);
@@ -631,7 +631,7 @@ out_clause : repeat_clause { $$ = cons($1, nil); }
| o_line { $$ = $1; }
;
-repeat_clause : REPEAT exprs_opt ')' newl
+repeat_clause : REPEAT n_exprs_opt ')' newl
out_clauses_opt
repeat_parts_opt
END newl { $$ = repeat_rep_helper(repeat_s,
@@ -706,7 +706,7 @@ o_elem : TEXT { $$ = string_own($1);
| rep_elem { $$ = $1; }
;
-rep_elem : REP exprs_opt ')' o_elems_opt
+rep_elem : REP n_exprs_opt ')' o_elems_opt
rep_parts_opt END { $$ = repeat_rep_helper(rep_s, $2, $4, $5);
rl($$, num($1)); }
| REP error { $$ = nil;