caml_tex: also provide error output on Lexing errors

I hit a Lexer error by mistakenly closing an environment with

    \end{caml_example*}{verbatim}

instead of

    \end{caml_example*}

and caml_tex would not quote the wrong input or indicate
at which line the error was, which makes debugging painful.
master
Gabriel Scherer 2018-08-27 18:06:08 +02:00
parent 14f29e0d65
commit 549ec6536b
1 changed files with 3 additions and 1 deletions

View File

@ -196,7 +196,9 @@ module Toplevel = struct
let str =
Ast_helper.[Str.modtype @@ Mtd.mk ~typ:(Mty.signature sign) name] in
Ptop_def str
with Syntaxerr.Error _ -> raise (Phrase_parsing s)
with
| Lexer.Error _ | Syntaxerr.Error _ ->
raise (Phrase_parsing s)
let take x = let r = !x in x := []; r