added error checking

svn: r16448

original commit: 2f47a882c955baa3111d3685af8c7cf10d364483
tokens
Robby Findler 15 years ago
parent 772b804fbd
commit 2a622c0cf3

@ -320,6 +320,9 @@
(define (make-parser start-number) (define (make-parser start-number)
(lambda (get-token) (lambda (get-token)
(unless (and (procedure? get-token)
(procedure-arity-includes? get-token 0))
(error 'get-token "expected a nullary procedure, got ~e" get-token))
(let parsing-loop ((stack (make-empty-stack start-number)) (let parsing-loop ((stack (make-empty-stack start-number))
(ip (get-token))) (ip (get-token)))
(let-values (((tok val start-pos end-pos) (let-values (((tok val start-pos end-pos)

Loading…
Cancel
Save