From 137ff928aab4f5b9dcc6f3b927c4ea92cf1d0a82 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Tue, 18 Dec 2012 23:35:36 +0100 Subject: [PATCH] eql to char= --- lispstrack.lisp | 4 ++-- test.lisp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) 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))))) -- 1.7.10.4