aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/character_escape.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/construct/character_escape.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/construct/character_escape.rs b/src/construct/character_escape.rs
index 494f1d2..ac91c29 100644
--- a/src/construct/character_escape.rs
+++ b/src/construct/character_escape.rs
@@ -44,15 +44,14 @@ use crate::tokenizer::Tokenizer;
/// ^
/// ```
pub fn start(tokenizer: &mut Tokenizer) -> State {
- match tokenizer.current {
- Some(b'\\') if tokenizer.parse_state.constructs.character_escape => {
- tokenizer.enter(Name::CharacterEscape);
- tokenizer.enter(Name::CharacterEscapeMarker);
- tokenizer.consume();
- tokenizer.exit(Name::CharacterEscapeMarker);
- State::Next(StateName::CharacterEscapeInside)
- }
- _ => State::Nok,
+ if tokenizer.parse_state.constructs.character_escape && tokenizer.current == Some(b'\\') {
+ tokenizer.enter(Name::CharacterEscape);
+ tokenizer.enter(Name::CharacterEscapeMarker);
+ tokenizer.consume();
+ tokenizer.exit(Name::CharacterEscapeMarker);
+ State::Next(StateName::CharacterEscapeInside)
+ } else {
+ State::Nok
}
}