From da79683d0ca4c96433c887162d793ce2f128d077 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 3 Sep 2009 12:09:19 -0400 Subject: [PATCH] Fix error reporting in PARSE-DEFINE-FORM. Change PARSE-DEFINE-FORM from returning two values to taking a continuation that must take two arguments and return a form, because ILL-FORMED-SYNTAX does not signal an error but returns a form classifying which signals an error. --- src/runtime/mit-syntax.scm | 17 ++++++++++------- src/runtime/sysmac.scm | 15 ++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/runtime/mit-syntax.scm b/src/runtime/mit-syntax.scm index 57796ab89..b7cb3d349 100644 --- a/src/runtime/mit-syntax.scm +++ b/src/runtime/mit-syntax.scm @@ -224,24 +224,27 @@ USA. variable-binding-theory))))) (lambda (form rename compare) compare ;ignore - (receive (name value) (parse-define-form form rename) - `(,keyword ,name ,value))))) + (parse-define-form form rename + (lambda (name value) + `(,keyword ,name ,value)))))) -(define (parse-define-form form rename) +(define (parse-define-form form rename receiver) (cond ((syntax-match? '((IDENTIFIER . MIT-BVL) + FORM) (cdr form)) (parse-define-form `(,(car form) ,(caadr form) (,(rename 'NAMED-LAMBDA) ,@(cdr form))) - rename)) + rename + receiver)) ((syntax-match? '((DATUM . MIT-BVL) + FORM) (cdr form)) (parse-define-form `(,(car form) ,(caadr form) (,(rename 'LAMBDA) ,(cdadr form) ,@(cddr form))) - rename)) + rename + receiver)) ((syntax-match? '(IDENTIFIER) (cdr form)) - (values (cadr form) (unassigned-expression))) + (receiver (cadr form) (unassigned-expression))) ((syntax-match? '(IDENTIFIER EXPRESSION) (cdr form)) - (values (cadr form) (caddr form))) + (receiver (cadr form) (caddr form))) (else (ill-formed-syntax form)))) diff --git a/src/runtime/sysmac.scm b/src/runtime/sysmac.scm index d3bcfb492..3550d67ef 100644 --- a/src/runtime/sysmac.scm +++ b/src/runtime/sysmac.scm @@ -98,10 +98,11 @@ USA. (er-macro-transformer (lambda (form rename compare) compare - (receive (name value) (parse-define-form form rename) - `(,(rename 'BEGIN) - (,(rename 'DEFINE) ,name) - (,(rename 'ADD-BOOT-INIT!) - (,(rename 'LAMBDA) () - (,(rename 'SET!) ,name ,value) - ,(rename 'UNSPECIFIC)))))))) \ No newline at end of file + (parse-define-form form rename + (lambda (name value) + `(,(rename 'BEGIN) + (,(rename 'DEFINE) ,name) + (,(rename 'ADD-BOOT-INIT!) + (,(rename 'LAMBDA) () + (,(rename 'SET!) ,name ,value) + ,(rename 'UNSPECIFIC))))))))) \ No newline at end of file -- 2.25.1