mirror of
https://github.com/danog/parser.git
synced 2024-11-26 20:04:57 +01:00
parent
23dda4d603
commit
31d9cef5aa
@ -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<()> {
|
||||
|
15
tests/0236/ast.txt
Normal file
15
tests/0236/ast.txt
Normal file
@ -0,0 +1,15 @@
|
||||
[
|
||||
InlineHtml(
|
||||
"<h1>\n ",
|
||||
),
|
||||
Echo {
|
||||
values: [
|
||||
LiteralString {
|
||||
value: "Hello, world!",
|
||||
},
|
||||
],
|
||||
},
|
||||
InlineHtml(
|
||||
"\n</h1>",
|
||||
),
|
||||
]
|
3
tests/0236/code.php
Normal file
3
tests/0236/code.php
Normal file
@ -0,0 +1,3 @@
|
||||
<h1>
|
||||
<?php echo "Hello, world!" ?>
|
||||
</h1>
|
52
tests/0236/tokens.txt
Normal file
52
tests/0236/tokens.txt
Normal file
@ -0,0 +1,52 @@
|
||||
[
|
||||
Token {
|
||||
kind: InlineHtml(
|
||||
"<h1>\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</h1>",
|
||||
),
|
||||
span: (
|
||||
2,
|
||||
34,
|
||||
),
|
||||
},
|
||||
]
|
Loading…
Reference in New Issue
Block a user