diff options
author | Chimrod <> | 2023-10-14 15:00:49 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-15 19:04:21 +0200 |
commit | 617d2ee554ccf502c718391aa05b7b72668b83e7 (patch) | |
tree | 3d376be8b5e8d111412602773688e9df81f6143d /lib/qparser/analyzer.ml | |
parent | 7ff1e525b39a42f94e32c65f8c2aac0a52465dc3 (diff) |
Added a new error case
Diffstat (limited to 'lib/qparser/analyzer.ml')
-rw-r--r-- | lib/qparser/analyzer.ml | 23 |
1 files changed, 15 insertions, 8 deletions
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 |