aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/character_escape.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 14:53:42 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 14:53:42 +0200
commitd87dc75500a2e73d9521135054b42c18e6eae987 (patch)
tree4bc3f4a72894db3ec5ed4069841c6be5be69713d /src/construct/character_escape.rs
parent6eb2f644057f371841fe25330a57ee185f91c7af (diff)
downloadmarkdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.tar.gz
markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.tar.bz2
markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.zip
Refactor to move some code to `event.rs`
Diffstat (limited to 'src/construct/character_escape.rs')
-rw-r--r--src/construct/character_escape.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/construct/character_escape.rs b/src/construct/character_escape.rs
index c3d5458..0cd7126 100644
--- a/src/construct/character_escape.rs
+++ b/src/construct/character_escape.rs
@@ -33,8 +33,8 @@
//! [character_reference]: crate::construct::character_reference
//! [hard_break_escape]: crate::construct::hard_break_escape
-use crate::state::{Name, State};
-use crate::token::Token;
+use crate::event::Name;
+use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
/// Start of a character escape.
@@ -46,11 +46,11 @@ 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(Token::CharacterEscape);
- tokenizer.enter(Token::CharacterEscapeMarker);
+ tokenizer.enter(Name::CharacterEscape);
+ tokenizer.enter(Name::CharacterEscapeMarker);
tokenizer.consume();
- tokenizer.exit(Token::CharacterEscapeMarker);
- State::Next(Name::CharacterEscapeInside)
+ tokenizer.exit(Name::CharacterEscapeMarker);
+ State::Next(StateName::CharacterEscapeInside)
}
_ => State::Nok,
}
@@ -62,15 +62,14 @@ pub fn start(tokenizer: &mut Tokenizer) -> State {
/// > | a\*b
/// ^
/// ```
-// Name::CharacterEscapeInside
pub fn inside(tokenizer: &mut Tokenizer) -> State {
match tokenizer.current {
// ASCII punctuation.
Some(b'!'..=b'/' | b':'..=b'@' | b'['..=b'`' | b'{'..=b'~') => {
- tokenizer.enter(Token::CharacterEscapeValue);
+ tokenizer.enter(Name::CharacterEscapeValue);
tokenizer.consume();
- tokenizer.exit(Token::CharacterEscapeValue);
- tokenizer.exit(Token::CharacterEscape);
+ tokenizer.exit(Name::CharacterEscapeValue);
+ tokenizer.exit(Name::CharacterEscape);
State::Ok
}
_ => State::Nok,