parser: skip comments in even more places

This commit is contained in:
Ryan Chandler 2022-08-09 21:16:24 +01:00
parent a76b8d54ef
commit 7ff2cb2c80
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -135,7 +135,7 @@ impl Parser {
fn statement(&mut self) -> ParseResult<Statement> {
self.skip_comments();
Ok(match &self.current.kind {
let statement = match &self.current.kind {
TokenKind::InlineHtml(html) => {
let s = Statement::InlineHtml(html.to_string());
self.next();
@ -152,7 +152,7 @@ impl Parser {
let condition = self.expression(0)?;
self.rparen();
self.rparen()?;
self.lbrace()?;
let body = self.block(&TokenKind::RightBrace)?;
@ -746,7 +746,11 @@ impl Parser {
Statement::Expression { expr }
}
})
};
self.skip_comments();
Ok(statement)
}
fn function(&mut self) -> ParseResult<Statement> {
@ -1385,6 +1389,8 @@ impl Parser {
break;
}
self.skip_comments();
Ok(lhs)
}