mirror of
https://github.com/danog/parser.git
synced 2024-11-26 20:04:57 +01:00
lexer: dont consume close tags in single line comments
This commit is contained in:
parent
aefa6a89a8
commit
78479f5861
@ -374,6 +374,11 @@ impl Lexer {
|
||||
|
||||
while let Some(c) = state.source.current() {
|
||||
if *c == b'\n' {
|
||||
state.source.next();
|
||||
break;
|
||||
}
|
||||
|
||||
if state.source.read(2) == [b'?', b'>'] {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -381,8 +386,6 @@ impl Lexer {
|
||||
state.source.next();
|
||||
}
|
||||
|
||||
state.source.next();
|
||||
|
||||
if buffer.starts_with(b"#") {
|
||||
TokenKind::HashMarkComment(buffer.into())
|
||||
} else {
|
||||
|
@ -23,7 +23,7 @@ fn main() -> ParseResult<()> {
|
||||
let lexer = Lexer::new();
|
||||
|
||||
let tokens = lexer.tokenize(&contents)?;
|
||||
// dbg!(&tokens);
|
||||
dbg!(&tokens);
|
||||
|
||||
let ast = php_parser_rs::parse(tokens)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user