summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-06 06:28:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-06 06:28:39 -0700
commit7c7d97f53e421e81e631c120559d0f6f11abc060 (patch)
tree4978231c5d1930a1be540a784572a318fd8deca2 /eval.c
parent14054b5ced1bd363b631ec5aade8d87f4a810b48 (diff)
downloadtxr-7c7d97f53e421e81e631c120559d0f6f11abc060.tar.gz
txr-7c7d97f53e421e81e631c120559d0f6f11abc060.tar.bz2
txr-7c7d97f53e421e81e631c120559d0f6f11abc060.zip
Better diagnosis for loose @ forms.
* eval.c (op_meta_error): New static function. (eval_init): Register sys:var and sys:expr as operators that throw error. * parser.y (sym_helper): Take parser_t instead of scanner_t argument so we have access to the name and line number. Obtain scanner internally from parser. Add source location info to (sys:var ...) form. (symhlpr): Retarget macro to pass parser rather than scanner to sm_helper.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index bb701106..398955f0 100644
--- a/eval.c
+++ b/eval.c
@@ -1163,6 +1163,11 @@ static val op_error(val form, val env)
abort();
}
+static val op_meta_error(val form, val env)
+{
+ eval_error(form, lit("meta with no meaning: ~s"), form, nao);
+}
+
static val op_quote(val form, val env)
{
val d = cdr(form);
@@ -4090,6 +4095,8 @@ void eval_init(void)
with_saved_vars_s = intern(lit("with-saved-vars"), system_package);
reg_op(macrolet_s, op_error);
reg_op(symacrolet_s, op_error);
+ reg_op(var_s, op_meta_error);
+ reg_op(expr_s, op_meta_error);
reg_op(quote_s, op_quote);
reg_op(qquote_s, op_qquote_error);
reg_op(sys_qquote_s, op_qquote_error);