aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/partial_data.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 13:45:24 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 13:45:24 +0200
commit6eb2f644057f371841fe25330a57ee185f91c7af (patch)
tree7b4d02586339d1a7f82104b4473d9ac243b3abf9 /src/construct/partial_data.rs
parent2d35cbfceace81a217cd0fbdae7a8777c7a6465e (diff)
downloadmarkdown-rs-6eb2f644057f371841fe25330a57ee185f91c7af.tar.gz
markdown-rs-6eb2f644057f371841fe25330a57ee185f91c7af.tar.bz2
markdown-rs-6eb2f644057f371841fe25330a57ee185f91c7af.zip
Refactor to move some code to `state.rs`
Diffstat (limited to 'src/construct/partial_data.rs')
-rw-r--r--src/construct/partial_data.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/construct/partial_data.rs b/src/construct/partial_data.rs
index 0ad67c5..c05aaa5 100644
--- a/src/construct/partial_data.rs
+++ b/src/construct/partial_data.rs
@@ -6,8 +6,9 @@
//! [string]: crate::content::string
//! [text]: crate::content::text
+use crate::state::{Name, State};
use crate::token::Token;
-use crate::tokenizer::{EventType, State, StateName, Tokenizer};
+use crate::tokenizer::{EventType, Tokenizer};
/// At the beginning of data.
///
@@ -21,9 +22,9 @@ pub fn start(tokenizer: &mut Tokenizer) -> State {
Some(byte) if tokenizer.tokenize_state.markers.contains(&byte) => {
tokenizer.enter(Token::Data);
tokenizer.consume();
- State::Next(StateName::DataInside)
+ State::Next(Name::DataInside)
}
- _ => State::Retry(StateName::DataAtBreak),
+ _ => State::Retry(Name::DataAtBreak),
}
}
@@ -40,7 +41,7 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State {
tokenizer.enter(Token::LineEnding);
tokenizer.consume();
tokenizer.exit(Token::LineEnding);
- State::Next(StateName::DataAtBreak)
+ State::Next(Name::DataAtBreak)
}
Some(byte) if tokenizer.tokenize_state.markers.contains(&byte) => {
tokenizer.register_resolver_before("data".to_string(), Box::new(resolve_data));
@@ -48,7 +49,7 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State {
}
_ => {
tokenizer.enter(Token::Data);
- State::Retry(StateName::DataInside)
+ State::Retry(Name::DataInside)
}
}
}
@@ -68,10 +69,10 @@ pub fn inside(tokenizer: &mut Tokenizer) -> State {
if done {
tokenizer.exit(Token::Data);
- State::Retry(StateName::DataAtBreak)
+ State::Retry(Name::DataAtBreak)
} else {
tokenizer.consume();
- State::Next(StateName::DataInside)
+ State::Next(Name::DataInside)
}
}