aboutsummaryrefslogtreecommitdiff
path: root/lib/qparser/analyzer.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/qparser/analyzer.ml')
-rw-r--r--lib/qparser/analyzer.ml23
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