summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-25 22:10:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-03-25 22:10:31 -0700
commitf4a6c56c8e8841c1991c1bb44546681ccbdb8f3a (patch)
tree943413daf7f15ed66562552b9cb43c8ada7053d0 /eval.c
parent4c6d387b73dca86caed48b1e786c5c1bc2c4716b (diff)
downloadtxr-f4a6c56c8e8841c1991c1bb44546681ccbdb8f3a.tar.gz
txr-f4a6c56c8e8841c1991c1bb44546681ccbdb8f3a.tar.bz2
txr-f4a6c56c8e8841c1991c1bb44546681ccbdb8f3a.zip
* eval.c (me_quasilist): New static function.
(eval_init): Register me_quasilist as quasilist macro expander. * lib.c (quasilist_s): New global variable. (obj_init): quasilist_s initialized. * lib.h (quasilist_s): Declared. * match.c (do_txreval): Handle quasilist syntax. * parser.l (QWLIT): New exclusive state. Extend lexical grammar to transition to QWLIT state upon the #` or #*` sequence which kicks off a word literal, and in that state, piecewise lexically analyze the QLL, mostly by borrowing rules from quasiliterals. * parser.y (QWORDS, QWSPLICE): New tokens. (n_exprs): Integrate splicing form of QLL syntax. (n_expr): Integrate non-splicing form of QLL syntax. (litchars): Propagate line number info. (quasilit): Fix "string literal" wording in error message. * txr.1: Introduced WLL abbreviation for word list literals, cleaned up the text a little, and documented QLL's.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 5c783371..e97432cc 100644
--- a/eval.c
+++ b/eval.c
@@ -2048,6 +2048,11 @@ static val me_until(val form, val menv)
rest(rest(form)), nao));
}
+static val me_quasilist(val form, val menv)
+{
+ return cons(list_s, cdr(form));
+}
+
val expand_forms(val form, val menv)
{
if (atom(form)) {
@@ -3214,6 +3219,7 @@ void eval_init(void)
reg_mac(intern(lit("unless"), user_package), me_unless);
reg_mac(intern(lit("while"), user_package), me_while);
reg_mac(intern(lit("until"), user_package), me_until);
+ reg_mac(quasilist_s, me_quasilist);
reg_fun(cons_s, func_n2(cons));
reg_fun(intern(lit("make-lazy-cons"), user_package), func_n1(make_lazy_cons));