From 7ff1e525b39a42f94e32c65f8c2aac0a52465dc3 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Sat, 7 Oct 2023 15:05:25 +0200 Subject: Added the error message in case of unclosed quote in a text --- lib/qparser/lexer.ml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/qparser/lexer.ml') diff --git a/lib/qparser/lexer.ml b/lib/qparser/lexer.ml index c643577..3e1c05b 100644 --- a/lib/qparser/lexer.ml +++ b/lib/qparser/lexer.ml @@ -4,7 +4,7 @@ open Tokens -exception UnclosedQuote of { content : string; line : int } +exception UnclosedQuote exception LexError of Lexing.position * string exception EOF @@ -29,13 +29,10 @@ let wait_balance : (Buffer.t -> Lexbuf.t -> 'a) -> Lexbuf.t -> 'a = let _, position = Lexbuf.positions lexbuf in Lexbuf.set_start_position lexbuf position; - try[@warning "-52"] + try let token = rule (Buffer.create 256) lexbuf in token - with Failure "lexing: empty token" -> - let position, _ = Lexbuf.positions lexbuf in - let line = position.Lexing.pos_lnum and content = Lexbuf.content lexbuf in - (raise (UnclosedQuote { line; content }) [@warning "+52"]) + with Not_found -> raise UnclosedQuote let space = [%sedlex.regexp? ' ' | '\t'] let eol = [%sedlex.regexp? '\r' | '\n' | "\r\n"] -- cgit v1.2.3