summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-18 17:43:56 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-18 17:43:56 -0800
commitd14ddd48c53f3d9ec960782c75f657a627456d22 (patch)
treef966df8f17c1a532a41ffa7c749edb0fd95418f5 /parser.y
parent3b1e713d392d607a37e9f6d1520c4f9f584d014d (diff)
downloadtxr-d14ddd48c53f3d9ec960782c75f657a627456d22.tar.gz
txr-d14ddd48c53f3d9ec960782c75f657a627456d22.tar.bz2
txr-d14ddd48c53f3d9ec960782c75f657a627456d22.zip
Allow braced output variables to actually be arbitrary substitutions.
* eval.c (subst_vars): Treat the variable as an arbitrary expression rather than just a symbol. * match.c (subst_vars): Likewise. * parser.y (o_var): Further simplification. The first item in an output var is an expr and not an IDENT. * txr.1: Updated. * txr.vim: Likewise.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y9
1 files changed, 4 insertions, 5 deletions
diff --git a/parser.y b/parser.y
index 7dc5d67b..ebcf63b3 100644
--- a/parser.y
+++ b/parser.y
@@ -636,11 +636,10 @@ o_var : IDENT { $$ = list(var_s, intern(string_own($1), nil),
nao); }
| IDENT o_elem { $$ = list(var_s, intern(string_own($1), nil),
$2, nao); }
- | '{' IDENT exprs_opt '}' { $$ = list(var_s, intern(string_own($2), nil),
- nil, $3, nao); }
- | '{' IDENT exprs_opt '}' o_elem
- { $$ = list(var_s, intern(string_own($2), nil),
- $5, $3, nao); }
+ | '{' expr exprs_opt '}'
+ { $$ = list(var_s, $2, nil, $3, nao); }
+ | '{' expr exprs_opt '}' o_elem
+ { $$ = list(var_s, $2, $5, $3, nao); }
| IDENT error { $$ = nil;
yybadtoken(yychar, lit("variable spec")); }
;