From 73fce5077e95838ab0c9007c3694933160c1f3b2 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Wed, 19 Feb 2025 15:53:57 +0000 Subject: [PATCH] Improve error for unexpected closing xml tag --- src/syntax/lexer.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/syntax/lexer.ml b/src/syntax/lexer.ml index 6a462e2bc57..ee128869ffc 100644 --- a/src/syntax/lexer.ml +++ b/src/syntax/lexer.ml @@ -31,6 +31,7 @@ type error_msg = | Invalid_escape of char * (string option) | Invalid_option | Unterminated_markup + | Unexpected_closing_markup_tag exception Error of error_msg * pos @@ -51,6 +52,7 @@ let error_msg = function | Invalid_escape (c,Some msg) -> Printf.sprintf "Invalid escape sequence \\%s. %s" (Char.escaped c) msg | Invalid_option -> "Invalid regular expression option" | Unterminated_markup -> "Unterminated markup literal" + | Unexpected_closing_markup_tag -> "Unexpected closing markup tag" type lexer_file = { lfile : string; @@ -717,6 +719,7 @@ let rec sharp_token lexbuf = let lex_xml p lexbuf = let name,pmin = match%sedlex lexbuf with + | '/' -> error Unexpected_closing_markup_tag p | xml_name -> lexeme lexbuf,lexeme_start lexbuf | _ -> invalid_char lexbuf in