Commit e13cf1ec62961d9f6cbc71f83c584fe6644a951c

Thomas de Grivel 2018-06-18T10:23:00

fix eof-token

diff --git a/css-lexer.lisp b/css-lexer.lisp
index 9be36b4..fddbcc3 100644
--- a/css-lexer.lisp
+++ b/css-lexer.lisp
@@ -439,14 +439,15 @@
       (discard-token lx)))
 
 (defmethod eof-token ((lx lexer))
-  (push-token lx)
-  (cond ((and (lexer-input-ended lx)
-              (= (lexer-match-start lx)
-                 (fill-pointer (lexer-buffer lx))))
-         (setf (lexer-eof-p lx) t)
-         (make-token lx 'eof-token))
-        (t
-         (discard-token lx))))
+  (unless (lexer-input-n lx 1)
+    (push-token lx)
+    (cond ((and (lexer-input-ended lx)
+                (= (lexer-match-start lx)
+                   (fill-pointer (lexer-buffer lx))))
+           (setf (lexer-eof-p lx) t)
+           (make-token lx 'eof-token))
+          (t
+           (discard-token lx)))))
 
 (defmethod delim-token ((lx lexer))
   (push-token lx)