Bladeren bron

Revert "[lexer] leave open-mode on `>` so we don't parse `<div>/>`" (#8404)

* Revert "[lexer] leave open-mode on `>` so we don't parse `<div>/>`"

This reverts commit b17bac736c9eb52708fc90251ce7a0ddf25a8185.

* Add test for #8404
Rudy Ges 6 jaren geleden
bovenliggende
commit
4047071504
3 gewijzigde bestanden met toevoegingen van 15 en 4 verwijderingen
  1. 1 4
      src/syntax/lexer.ml
  2. 13 0
      tests/misc/projects/Issue8404/Main.hx
  3. 1 0
      tests/misc/projects/Issue8404/compile.hxml

+ 1 - 4
src/syntax/lexer.ml

@@ -592,10 +592,7 @@ and not_xml ctx depth in_open =
 		let depth = if in_open then depth - 1 else depth in
 		if depth < 0 then lexeme_end lexbuf
 		else not_xml ctx depth false
-	| '>' ->
-		store lexbuf;
-		not_xml ctx depth false
-	| '<' | '/' ->
+	| '<' | '/' | '>' ->
 		store lexbuf;
 		not_xml ctx depth in_open
 	| Plus (Compl ('<' | '/' | '>' | '\n' | '\r')) ->

+ 13 - 0
tests/misc/projects/Issue8404/Main.hx

@@ -0,0 +1,13 @@
+class Main {
+	public static function main() {
+		trace(markup(<something onClick={e -> e.preventDefault()} />));
+		trace(markup(<something isSelected={42 > 0} />));
+	}
+
+	static macro function markup(e) {
+		return switch e {
+			case macro @:markup $v: macro "ok";
+			case _: throw 'Not markup';
+		};
+	}
+}

+ 1 - 0
tests/misc/projects/Issue8404/compile.hxml

@@ -0,0 +1 @@
+-main Main