summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-04 22:23:36 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-04 22:23:36 -0800
commit7fa8698dbec1812d13d8d7a1f323329baa9a10c4 (patch)
tree3b21f73497626c4cf9beff7d00996356e681a084 /parser.y
parent0b205139823e033dca63719ff8a6e0b390c96476 (diff)
downloadtxr-7fa8698dbec1812d13d8d7a1f323329baa9a10c4.tar.gz
txr-7fa8698dbec1812d13d8d7a1f323329baa9a10c4.tar.bz2
txr-7fa8698dbec1812d13d8d7a1f323329baa9a10c4.zip
* parser.y (force_regular_quotes): Function removed.
(list): Prior commit reversed. * txr.1: Prior commit reversed. * RELNOTES: No semantics clarification in quasiquote; bugfixes only.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y38
1 files changed, 8 insertions, 30 deletions
diff --git a/parser.y b/parser.y
index e4f954ce..82fd9101 100644
--- a/parser.y
+++ b/parser.y
@@ -50,7 +50,6 @@ static val define_transform(val define_form);
static val lit_char_helper(val litchars);
static val optimize_text(val text_form);
static val choose_quote(val quoted_form);
-static val force_regular_quotes(val form);
static wchar_t char_from_name(wchar_t *name);
static val parsed_spec;
@@ -608,14 +607,16 @@ var_op : '*' { $$ = list(t, nao); }
list : '(' exprs ')' { $$ = rl($2, num($1)); }
| '(' ')' { $$ = nil; }
- | ',' expr { $$ = rlcp(list(unquote_s,
- force_regular_quotes($2), nao),
- $2); }
+ | ',' expr { val expr = $2;
+ if (consp(expr) && first(expr) == qquote_s)
+ expr = cons(quote_s, rest(expr));
+ $$ = rlcp(list(unquote_s, expr, nao), $2); }
| '\'' expr { $$ = rlcp(list(choose_quote($2),
$2, nao), $2); }
- | SPLICE expr { $$ = rlcp(list(splice_s,
- force_regular_quotes($2), nao),
- $2); }
+ | SPLICE expr { val expr = $2;
+ if (consp(expr) && first(expr) == qquote_s)
+ expr = cons(quote_s, rest(expr));
+ $$ = rlcp(list(splice_s, expr, nao), $2); }
| '(' error { $$ = nil;
yybadtoken(yychar, lit("list expression")); }
;
@@ -911,29 +912,6 @@ static val choose_quote(val quoted_form)
return unquotes_occur(quoted_form) ? qquote_s : quote_s;
}
-static val force_regular_quotes(val form)
-{
- if (atom(form)) {
- return form;
- } else {
- val sym = car(form);
- val body = cdr(form);
-
- if (sym == qquote_s) {
- return rlcp(cons(quote_s, force_regular_quotes(body)), form);
- } if (sym == unquote_s || sym == splice_s) {
- return form;
- } else {
- val car_sub = force_regular_quotes(sym);
- val cdr_sub = force_regular_quotes(body);
-
- if (car_sub == sym && cdr_sub == body)
- return form;
- return rlcp(cons(car_sub, cdr_sub), form);
- }
- }
-}
-
val rl(val form, val lineno)
{
sethash(form_to_ln_hash, form, lineno);