Skip to content

Commit

Permalink
Improve error for unexpected closing xml tag
Browse files Browse the repository at this point in the history
  • Loading branch information
tobil4sk committed Feb 19, 2025
1 parent 1249ed9 commit 73fce50
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/syntax/lexer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 73fce50

Please sign in to comment.