diff options
author | Chimrod <> | 2023-10-07 15:05:25 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-07 15:05:25 +0200 |
commit | 7ff1e525b39a42f94e32c65f8c2aac0a52465dc3 (patch) | |
tree | 45e3557a12fe868ddd3dc96488129244ef807ec9 /lib/qparser/lexer.ml | |
parent | 97ab5c9a21166f0bffee482210d69877fd6809fa (diff) |
Added the error message in case of unclosed quote in a text
Diffstat (limited to 'lib/qparser/lexer.ml')
-rw-r--r-- | lib/qparser/lexer.ml | 9 |
1 files changed, 3 insertions, 6 deletions
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"] |