From 622bbf897af29ec6f7d533f915b0170d3a9c899f Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Sun, 1 Oct 2023 19:07:17 +0200 Subject: Added some test for syntax errors --- lib/analyzer.ml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/analyzer.ml') diff --git a/lib/analyzer.ml b/lib/analyzer.ml index 7a64cab..da1adbf 100644 --- a/lib/analyzer.ml +++ b/lib/analyzer.ml @@ -23,13 +23,13 @@ let parse : | Interpreter.InvalidSyntax -> "Invalid Syntax" | Interpreter.UnrecoverableError -> "UnrecoverableError" | Interpreter.MenhirCode c -> - String.concat "" - [ - String.trim @@ Parser_messages.message c; - " (Error code "; - string_of_int c; - ")"; - ] + let message_content = + try Parser_messages.message c + with Not_found -> + String.concat "" [ "(Error code "; string_of_int c; ")" ] + in + + String.concat "" [ String.trim @@ message_content ] in let report = Qsp_syntax.Report.error (e.start_pos, e.end_pos) message -- cgit v1.2.3