diff --git a/token-stream.lisp b/token-stream.lisp
index 1e0dffd..2cbd57e 100644
--- a/token-stream.lisp
+++ b/token-stream.lisp
@@ -178,11 +178,8 @@ stack."))
(let ((length (- (the fixnum (fill-pointer (lexer-buffer lx)))
(the fixnum (lexer-match-start lx)))))
(declare (type fixnum length))
- (when (lexer-input-ended lx)
- (if (= 0 length)
- (signal (make-instance 'end-of-file :stream lx))
- (return)))
- (unless (< length n)
+ (when (or (lexer-input-ended lx)
+ (<= n length))
(return))
(lexer-input lx))))