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
(lambda (tok-type tok-value offset line column span)
(raise (exn:fail:parsing
(format "Encountered unexpected token ~e (~e) while parsing ~e [line=~a, column=~a, offset=~a]"
tok-type
tok-value
(current-source)
line column offset)
(string-append
(format "Encountered unexpected token ~e (~e) while parsing" tok-type tok-value)
(if (or (current-source) line column offset)
(format " ~e [line=~a, column=~a, offset=~a]" (current-source) line column offset)
""))
(current-continuation-marks)
(list (srcloc (current-source) line column offset span)))))))

Loading…
Cancel
Save