From 24860a540f5b44a68ac5c24642ca8029cdbbd609 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 24 Oct 2023 15:46:53 +0200 Subject: [PATCH] never crash --- flap/src/hopix/hopixLexer.mll | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flap/src/hopix/hopixLexer.mll b/flap/src/hopix/hopixLexer.mll index ef6815c..0f2b370 100644 --- a/flap/src/hopix/hopixLexer.mll +++ b/flap/src/hopix/hopixLexer.mll @@ -31,12 +31,12 @@ | "\\\"" -> Some '"' | "\\\\" -> Some '\\' | _ -> - (match String.get data 1 with - | '0' | '1' | '2' -> - let caractere = String.sub data 1 (String.length data - 1) in - let ascii_code = int_of_string caractere in - Some (Char.chr ascii_code) - | _ -> None) + (try + let caractere = String.sub data 1 (String.length data - 1) in + let ascii_code = int_of_string caractere in + Some (Char.chr ascii_code) + with + | _ -> None) ;; }