From: Chris Hanson Date: Wed, 21 Jun 2006 13:45:52 +0000 (+0000) Subject: Handle atom delimiters specially when they are the first character X-Git-Tag: 20090517-FFI~999 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=31f7cd80d49c06837924169112fa80da2aff5808;p=mit-scheme.git Handle atom delimiters specially when they are the first character after "#\". --- diff --git a/v7/src/runtime/parse.scm b/v7/src/runtime/parse.scm index 757f7acf4..28247abaf 100644 --- a/v7/src/runtime/parse.scm +++ b/v7/src/runtime/parse.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: parse.scm,v 14.62 2006/06/21 02:57:28 cph Exp $ +$Id: parse.scm,v 14.63 2006/06/21 13:45:52 cph Exp $ Copyright 1986,1987,1988,1989,1990,1991 Massachusetts Institute of Technology Copyright 1992,1993,1994,1997,1998,1999 Massachusetts Institute of Technology @@ -497,24 +497,27 @@ USA. (define (handler:char port db ctx char1 char2) db ctx char1 char2 - (name->char (read-char-name port))) - -(define (read-char-name port) - (call-with-output-string - (lambda (port*) - (let ((char (read-char/no-eof port))) - (write-char char port*) - (let loop () - (let ((char (peek-char port))) - (if (not (or (eof-object? char) - (atom-delimiter? char))) - (begin - (discard-char port) - (write-char (if (char=? char #\\) - (read-char/no-eof port) - char) - port*) - (loop))))))))) + (let ((char (read-char/no-eof port)) + (at-end? + (lambda () + (let ((char (peek-char port))) + (or (eof-object? char) + (atom-delimiter? char)))))) + (if (or (atom-delimiter? char) + (at-end?)) + char + (name->char + (call-with-output-string + (lambda (port*) + (write-char char port*) + (let loop () + (write-char (let ((char (read-char/no-eof port))) + (if (char=? char #\\) + (read-char/no-eof port) + char)) + port*) + (if (not (at-end?)) + (loop))))))))) (define (handler:named-constant port db ctx char1 char2) ctx char1 char2