diff --git a/src/parser/internal/punc.rs b/src/parser/internal/punc.rs index ecf6b85..3614eec 100644 --- a/src/parser/internal/punc.rs +++ b/src/parser/internal/punc.rs @@ -7,7 +7,11 @@ use crate::expect_token; impl Parser { pub(in crate::parser) fn semi(&self, state: &mut State) -> ParseResult<()> { - expect_token!([TokenKind::SemiColon => Ok(())], state, "`;`") + if state.current.kind != TokenKind::CloseTag { + expect_token!([TokenKind::SemiColon => Ok(())], state, "`;`") + } else { + Ok(()) + } } pub(in crate::parser) fn lbrace(&self, state: &mut State) -> ParseResult<()> { diff --git a/tests/0236/ast.txt b/tests/0236/ast.txt new file mode 100644 index 0000000..b12f684 --- /dev/null +++ b/tests/0236/ast.txt @@ -0,0 +1,15 @@ +[ + InlineHtml( + "

\n ", + ), + Echo { + values: [ + LiteralString { + value: "Hello, world!", + }, + ], + }, + InlineHtml( + "\n

", + ), +] diff --git a/tests/0236/code.php b/tests/0236/code.php new file mode 100644 index 0000000..7b24ae5 --- /dev/null +++ b/tests/0236/code.php @@ -0,0 +1,3 @@ +

+ +

\ No newline at end of file diff --git a/tests/0236/tokens.txt b/tests/0236/tokens.txt new file mode 100644 index 0000000..c244a5f --- /dev/null +++ b/tests/0236/tokens.txt @@ -0,0 +1,52 @@ +[ + Token { + kind: InlineHtml( + "

\n ", + ), + span: ( + 1, + 1, + ), + }, + Token { + kind: OpenTag( + Full, + ), + span: ( + 2, + 5, + ), + }, + Token { + kind: Echo, + span: ( + 2, + 11, + ), + }, + Token { + kind: LiteralString( + "Hello, world!", + ), + span: ( + 2, + 16, + ), + }, + Token { + kind: CloseTag, + span: ( + 2, + 32, + ), + }, + Token { + kind: InlineHtml( + "\n

", + ), + span: ( + 2, + 34, + ), + }, +]