From: David Vázquez Date: Tue, 18 Dec 2012 22:35:36 +0000 (+0100) Subject: eql to char= X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=137ff928aab4f5b9dcc6f3b927c4ea92cf1d0a82;p=jscl.git eql to char= --- diff --git a/lispstrack.lisp b/lispstrack.lisp index b20ca47..ee1aab7 100644 --- a/lispstrack.lisp +++ b/lispstrack.lisp @@ -112,8 +112,8 @@ (let (ch) (skip-whitespaces stream) (setq ch (%peek-char stream)) - (while (and ch (eql ch #\;)) - (read-until stream (lambda (x) (eql x #\newline))) + (while (and ch (char= ch #\;)) + (read-until stream (lambda (x) (char= x #\newline))) (skip-whitespaces stream) (setq ch (%peek-char stream))))) diff --git a/test.lisp b/test.lisp index 560a255..7a68a35 100644 --- a/test.lisp +++ b/test.lisp @@ -209,3 +209,21 @@ (or (null ch) (whitespacep ch) (char= #\) ch) (char= #\( ch))) +(defun read-until (stream func) + (let ((string "") + (ch)) + (setq ch (%peek-char stream)) + (while (not (funcall func ch)) + (setq string (concat string (string ch))) + (%read-char stream) + (setq ch (%peek-char stream))) + string)) + +(defun skip-whitespaces-and-comments (stream) + (let (ch) + (skip-whitespaces stream) + (setq ch (%peek-char stream)) + (while (and ch (char= ch #\;)) + (read-until stream (lambda (x) (char= x #\newline))) + (skip-whitespaces stream) + (setq ch (%peek-char stream)))))