From 617d2ee554ccf502c718391aa05b7b72668b83e7 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Sat, 14 Oct 2023 15:00:49 +0200 Subject: Added a new error case --- lib/qparser/analyzer.ml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'lib/qparser/analyzer.ml') diff --git a/lib/qparser/analyzer.ml b/lib/qparser/analyzer.ml index c165d03..fba96e0 100644 --- a/lib/qparser/analyzer.ml +++ b/lib/qparser/analyzer.ml @@ -17,14 +17,21 @@ let parse : let init = Parser.Incremental.main (fst (Lexbuf.positions l)) in let evaluation = - try IncrementalParser.of_lexbuf lexer l init - with Lexer.UnclosedQuote -> - let start_pos, end_pos = Lexbuf.positions l in - let err = - IncrementalParser. - { code = Interpreter.Custom "Unclosed text"; start_pos; end_pos } - in - Error err + try IncrementalParser.of_lexbuf lexer l init with + | Lexer.LexError message -> + let start_pos, end_pos = Lexbuf.positions l in + let err = + IncrementalParser. + { code = Interpreter.Custom message; start_pos; end_pos } + in + Error err + | Lexer.UnclosedQuote -> + let start_pos, end_pos = Lexbuf.positions l in + let err = + IncrementalParser. + { code = Interpreter.Custom "Unclosed text"; start_pos; end_pos } + in + Error err in Result.map_error -- cgit v1.2.3