From 7c7d97f53e421e81e631c120559d0f6f11abc060 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 6 Aug 2015 06:28:39 -0700 Subject: 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. --- eval.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'eval.c') 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); -- cgit v1.2.3