suppress source info in errors when it doesn't exist

pull/14/head
Matthew Butterick 6 years ago
parent 6cf947b8af
commit e6b8f99316

@ -27,10 +27,10 @@
(make-parameter (make-parameter
(lambda (tok-type tok-value offset line column span) (lambda (tok-type tok-value offset line column span)
(raise (exn:fail:parsing (raise (exn:fail:parsing
(format "Encountered unexpected token ~e (~e) while parsing ~e [line=~a, column=~a, offset=~a]" (string-append
tok-type (format "Encountered unexpected token ~e (~e) while parsing" tok-type tok-value)
tok-value (if (or (current-source) line column offset)
(current-source) (format " ~e [line=~a, column=~a, offset=~a]" (current-source) line column offset)
line column offset) ""))
(current-continuation-marks) (current-continuation-marks)
(list (srcloc (current-source) line column offset span))))))) (list (srcloc (current-source) line column offset span)))))))

Loading…
Cancel
Save