codeblock reports errors in terms of read-syntax
LiberalArtist opened this issue · 0 comments
LiberalArtist commented
When codeblock
can't parse its arguments, the error can be raised in terms of read-syntax
. For example, the following program produces the error message “:4:4: read-syntax: bad syntax #
” at runtime (not at read-time):
#lang scribble/manual
@codeblock{
`@"`"`
A ::= B
| C
| D # which is an E
`@"`"`
}
This inspired @shriram's example in greghendershott/markdown#84. With that example, the srcloc
points to the markdown/scrib
library:
#lang at-exp racket
(require markdown markdown/scrib scribble/decode)
(define xs
(parameterize ([current-input-port
(open-input-string
@string-append{```
A ::= B
| C
| D # which is an E
```})])
(read-markdown)))
xs
(with-handlers ([exn:fail? (λ (e) e)])
(xexprs->scribble-pres xs))