From bd37080059696bcd17458b8e86b15119552cda6e Mon Sep 17 00:00:00 2001 From: Andrea Griffini Date: Sat, 4 May 2013 09:52:58 +0200 Subject: [PATCH] removed unused function and added detection for multiple objects following a dot when reading a list --- src/read.lisp | 58 +++++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/src/read.lisp b/src/read.lisp index 4116bb6..0cfe563 100644 --- a/src/read.lisp +++ b/src/read.lisp @@ -99,30 +99,33 @@ (skip-whitespaces-and-comments stream) (let ((ch (%peek-char stream))) (cond - ((null ch) - (error "Unspected EOF")) - ((char= ch #\)) - (discard-char stream #\)) - nil) - (t - (let* ((eof (gensym)) - (next (ls-read stream nil eof))) - (skip-whitespaces-and-comments stream) - (cond - ((eq next eof) - (discard-char stream #\))) - (t - (cons next - (if (char= (%peek-char stream) #\.) - (progn - (discard-char stream #\.) - (if (terminalp (%peek-char stream)) - (prog1 (ls-read stream) ; Dotted pair notation - (discard-char stream #\))) - (let ((token (concat "." (read-escaped-until stream #'terminalp)))) - (cons (interpret-token token) - (%read-list stream))))) - (%read-list stream)))))))))) + ((null ch) + (error "Unspected EOF")) + ((char= ch #\)) + (discard-char stream #\)) + nil) + (t + (let* ((eof (gensym)) + (next (ls-read stream nil eof))) + (skip-whitespaces-and-comments stream) + (cond + ((eq next eof) + (discard-char stream #\))) + (t + (cons next + (if (char= (%peek-char stream) #\.) + (progn + (discard-char stream #\.) + (if (terminalp (%peek-char stream)) + (prog1 (ls-read stream) ; Dotted pair notation + (skip-whitespaces-and-comments stream) + (if (char= (%peek-char stream) #\) ) + (discard-char stream #\)) + (error "More than one object follows . in list"))) + (let ((token (concat "." (read-escaped-until stream #'terminalp)))) + (cons (interpret-token token) + (%read-list stream))))) + (%read-list stream)))))))))) (defun read-string (stream) (let ((string "") @@ -172,13 +175,6 @@ (setq result (concat result (string (char x i)))))) result)) -(defun escape-all (x) - (let ((result "")) - (dotimes (i (length x)) - (setq result (concat result "\\")) - (setq result (concat result (string (char x i))))) - result)) - (defun string-upcase-noescaped (s) (let ((result "") (last-escape nil)) -- 1.7.10.4