diff options
| author | Stanisław Zagórowski <hasohasacz@gmail.com> | 2024-01-12 20:35:12 +0100 |
|---|---|---|
| committer | Stanisław Zagórowski <hasohasacz@gmail.com> | 2024-01-12 20:35:12 +0100 |
| commit | a56af29e6808ae4194f4a7fc5f7c906b146bb88e (patch) | |
| tree | b643a5defd1c26c9278eb0387967447cb95da24d /src/luax/preprocessor.rs | |
| parent | 4a11fd2bd6329af21f8a3c60d70afc973f6518a4 (diff) | |
minor fixes to unknown handling
Diffstat (limited to 'src/luax/preprocessor.rs')
| -rw-r--r-- | src/luax/preprocessor.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/luax/preprocessor.rs b/src/luax/preprocessor.rs index cd5d735..2e24c27 100644 --- a/src/luax/preprocessor.rs +++ b/src/luax/preprocessor.rs @@ -873,17 +873,7 @@ impl<'s, W: Write> Preprocessor<'s, W> { } // there might be an invalid token immediately after the tag name - match self.consume_token_silent(Token::Gt, LuaXError::NeededToken(Token::Gt.to_string())) { - Ok(()) => {} - Err(e) => match e.downcast_ref::<LuaXError>() { - Some(LuaXError::UnexpectedCharacter(_)) => { - self.lexer.enable_html_text_mode(); - self.next_token_silent()?; - self.lexer.disable_html_text_mode(); - }, - _ => return Err(e), - }, - } + self.consume_token_silent(Token::Gt, LuaXError::NeededToken(Token::Gt.to_string()))?; self.html_children()?; @@ -973,7 +963,6 @@ impl<'s, W: Write> Preprocessor<'s, W> { Ok(t) => Some(t), Err(e) => match e.downcast_ref::<LuaXError>() { Some(LuaXError::InvalidStart) => None, - Some(LuaXError::UnexpectedCharacter(_)) => None, _ => return Err(e), }, } @@ -995,6 +984,9 @@ impl<'s, W: Write> Preprocessor<'s, W> { write!(self.out_stream, " \"")?; self.lexer.enable_html_text_mode(); loop { + if matches!(self.current, Token::Unknown(_)) { + self.next_token_silent()?; + } if self.current == Token::Lt || self.current == Token::LuaStart || self.current == Token::OpenClosingTag |
