9b0ba684a64cf7ea6f516865ef923c4697c68b0c — Alex Karle 1 year, 5 months ago 7dc01d4
parser: Fix synchronization at end of input

In Scheme, only #f is falsey:

> (if 0 (print "truthy"))

> (if '() (print "truthy"))

So checking (and toks ...) wasn't doing the empty list check I was intending!
1 files changed, 1 insertions(+), 1 deletions(-)

M parser.scm
M parser.scm => parser.scm +1 -1
@@ 181,7 181,7 @@
  ;; Loop through declarations, starting with tokens BUT using call/cc
  ;; to bookmark the loop so we can synchronize on parse-err!
  (let loop ((toks (call/cc (lambda (cc) (set! parser-sync cc) tokens))))
    (if (and toks (not (top-type? toks '(EOF))))
    (if (and (not (null? toks)) (not (top-type? toks '(EOF))))
      (let-values (((expr rest) (parse-declaration toks)))
        (cons expr (loop rest)))