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 diff --git a/tests/misc/projects/Issue12021/Main.hx b/tests/misc/projects/Issue12021/Main.hx new file mode 100644 index 00000000000..613e7207acf --- /dev/null +++ b/tests/misc/projects/Issue12021/Main.hx @@ -0,0 +1,6 @@ +function main() { + + // typo + + +} diff --git a/tests/misc/projects/Issue12021/compile-fail.hxml b/tests/misc/projects/Issue12021/compile-fail.hxml new file mode 100644 index 00000000000..b30a755894b --- /dev/null +++ b/tests/misc/projects/Issue12021/compile-fail.hxml @@ -0,0 +1,2 @@ +--main Main +--interp \ No newline at end of file diff --git a/tests/misc/projects/Issue12021/compile-fail.hxml.stderr b/tests/misc/projects/Issue12021/compile-fail.hxml.stderr new file mode 100644 index 00000000000..3b8df7d1869 --- /dev/null +++ b/tests/misc/projects/Issue12021/compile-fail.hxml.stderr @@ -0,0 +1 @@ +Main.hx:5: character 2 : Unexpected closing markup tag