Skip to content

Commit

Permalink
catch Sedlexing errors (Deducteam#1123)
Browse files Browse the repository at this point in the history
  • Loading branch information
fblanqui authored Jun 24, 2024
1 parent 51d6eec commit 2cb70da
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parsing/lpLexer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ and comment next i lb =
(** [token buf] is a lexing function on buffer [buf] that can be passed to
a parser. *)
let token : lexbuf -> unit -> token * Lexing.position * Lexing.position =
with_tokenizer token
fun lb () -> try with_tokenizer token lb () with
| Sedlexing.MalFormed -> fail lb "Not Utf8 encoded file"
| Sedlexing.InvalidCodepoint k ->
fail lb ("Invalid Utf8 code point " ^ string_of_int k)

let token =
let r = ref (EOF, Lexing.dummy_pos, Lexing.dummy_pos) in fun lb () ->
Expand Down

0 comments on commit 2cb70da

Please sign in to comment.