aboutsummaryrefslogtreecommitdiff
path: root/lib/analyzer.ml
diff options
context:
space:
mode:
authorChimrod <>2023-10-01 19:07:17 +0200
committerChimrod <>2023-10-01 19:07:17 +0200
commit622bbf897af29ec6f7d533f915b0170d3a9c899f (patch)
treef985dc2f40c8ca9938e93b75fb266fe2b12330ae /lib/analyzer.ml
parent2e41a214e4c2a2984ad3b2afa3d80178d227927f (diff)
Added some test for syntax errors
Diffstat (limited to 'lib/analyzer.ml')
-rw-r--r--lib/analyzer.ml14
1 files changed, 7 insertions, 7 deletions
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