commit 6adb10f3b756b64c3a4fad84958486eadff1f8e4 (patch)
parent 482f0e2d957d1b1c114e3a833c4c358656688394
Author: Alex Karle <alex@alexkarle.com>
Date: Sun, 2 Oct 2022 11:36:06 -0400
scanner: Fix recording of !><= at very end
Since we keep these in the `in` state, if we see EOF we can't end until
we actually clear `in`!
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scanner.scm b/scanner.scm
@@ -39,10 +39,10 @@
(get-tokens (add1 i2) (add1 i2) line #f)))
(let ((c (peek i)))
- (if (not c)
+ (if (and (not in) (not c))
(list (make-token 'EOF "" #f line))
(cond
- ((eq? in 'comment) (if (eq? #\newline c)
+ ((eq? in 'comment) (if (or (not c) (eq? #\newline c))
(get-tokens (add1 i) (add1 i) (add1 line) #f)
(get-tokens s (add1 i) line 'comment)))
((eq? in 'string) #f)