summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-11-29 19:43:05 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-11-29 19:43:05 -0800
commit6f8a6cf7c99810aa6c7f2254bce22c0fd1eedebe (patch)
tree9c6dc3ed39c6692e92dcbac8da279b6850d160cd /parser.y
parent317f52faaee418a3a64b8c7d7a778e78b65e84c6 (diff)
downloadtxr-6f8a6cf7c99810aa6c7f2254bce22c0fd1eedebe.tar.gz
txr-6f8a6cf7c99810aa6c7f2254bce22c0fd1eedebe.tar.bz2
txr-6f8a6cf7c99810aa6c7f2254bce22c0fd1eedebe.zip
Support assignment to (car ...) and (cdr ...).
* eval.c (car_s, cdr_s): New symbol variables. (op_modplace): Cases for car and cdr added. (expand_place): Likewise. Calls abort should the cases fall through rather than returning 42. (expand): Bugfix: for and for* case not propagating source location info. Bugfix: expansion for do added. (eval_init): car_s and cdr_s initialized and used in place of previous intern calls. * parser.y (elem): Removed wrong logic for expanding the do form. It was expanding only the first argument.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y11
1 files changed, 3 insertions, 8 deletions
diff --git a/parser.y b/parser.y
index 6aa4d2e0..00d47b09 100644
--- a/parser.y
+++ b/parser.y
@@ -293,14 +293,9 @@ elem : texts { $$ = rlcp(cons(text_s, $1), $1);
$$ = rlcp(optimize_text($$), $$); }
| var { $$ = rl($1, num(lineno)); }
| list { if (first($1) == do_s)
- { val form = second($1);
- val form_ex = expand(form);
-
- if (form == form_ex)
- $$ = $1;
- else
- $$ = rlcp(cons(do_s, cons(form_ex, nil)),
- $1); }}
+ $$ = expand($1);
+ else
+ $$ = $1; }
| COLL exprs_opt ')' elems END { $$ = list(coll_s, $4, nil, $2, nao);
rl($$, num($1)); }
| COLL exprs_opt ')' elems