cl: Tidy up parser slightly.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 18 Nov 2009 13:28:06 +0000 (13:28 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 18 Nov 2009 13:28:06 +0000 (13:28 +0000)
Most of the other implementations don't have separate cases for end-of-
input and not-open-paren; so don't penalize Lisp because I decided to
make the parser more extendable.

cl-fringe.lisp

index 3716f3b..a2ddf85 100644 (file)
@@ -63,9 +63,7 @@
 
   (let ((len (length string)))
     (labels ((parse (i)
-              (cond ((>= i len)
-                     (values nil i))
-                    ((char= (char string i) #\()
+              (cond ((and (< i len) (char= (char string i) #\())
                      (multiple-value-bind (left i) (parse (1+ i))
                        (unless (< i len) (error "no data"))
                        (let ((data (char string i)))