From 177f6b84a759b806773c032386bd6490559952dd Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Mon, 14 Apr 2008 22:18:56 -0400 Subject: [PATCH] Fixed a reader bug that causes '#!eof not to read properly. Used to be: > '#!eof Unhandled exception Condition components: 1. &lexical 2. &message: "invalid eof after quote read macro" 3. &lexical-position: file-name: *stdin* character: 7 Now: > '#!eof #!eof --- scheme/ikarus.reader.ss | 26 +++++++++++++++----------- scheme/last-revision | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/scheme/ikarus.reader.ss b/scheme/ikarus.reader.ss index 1b6a4be..fa75360 100644 --- a/scheme/ikarus.reader.ss +++ b/scheme/ikarus.reader.ss @@ -1239,17 +1239,21 @@ (values (cdr t) (annotate-simple (cdr t) pos p) locs k)] [(eq? (car t) 'macro) - (let-values ([(expr expr^ locs k) - (read-expr p locs k)]) - (when (eof-object? expr) - (die/p p 'read - (format "invalid eof after ~a read macro" - (cdr t)))) - (let ([x (list expr)] [x^ (list expr^)]) - (values (cons (cdr t) x) - (cons (annotate-simple (cdr t) pos p) x^) - locs - (extend-k-pair x x^ expr '() k))))] + (let ([macro (cdr t)]) + (define (read-macro) + (let-values ([(t pos) (tokenize/1+pos p)]) + (cond + [(eof-object? t) + (die/p p 'read + (format "invalid eof after ~a read macro" + macro))] + [else (parse-token p locs k t pos)]))) + (let-values ([(expr expr^ locs k) (read-macro)]) + (let ([x (list expr)] [x^ (list expr^)]) + (values (cons macro x) + (cons (annotate-simple macro pos p) x^) + locs + (extend-k-pair x x^ expr '() k)))))] [(eq? (car t) 'mark) (let ([n (cdr t)]) (let-values ([(expr expr^ locs k) diff --git a/scheme/last-revision b/scheme/last-revision index a3cd116..f7df7fd 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1448 +1449