aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/html_flow.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 17:26:17 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-11 17:26:17 +0200
commit0d9c4611922535533746d1a86f10ef4e701c950e (patch)
treedd776161db75ba264b67830635b736ca5dd5c314 /src/construct/html_flow.rs
parent90969231bfcdfcd09bae646abba17d832b633376 (diff)
downloadmarkdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.tar.gz
markdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.tar.bz2
markdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.zip
Refactor attempts to remove unneeded state name
Diffstat (limited to 'src/construct/html_flow.rs')
-rw-r--r--src/construct/html_flow.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/construct/html_flow.rs b/src/construct/html_flow.rs
index 9998797..b5e1815 100644
--- a/src/construct/html_flow.rs
+++ b/src/construct/html_flow.rs
@@ -133,7 +133,8 @@ const COMPLETE: u8 = 7;
pub fn start(tokenizer: &mut Tokenizer) -> State {
if tokenizer.parse_state.constructs.html_flow {
tokenizer.enter(Name::HtmlFlow);
- let name = space_or_tab_with_options(
+ tokenizer.attempt(State::Next(StateName::HtmlFlowBefore), State::Nok);
+ State::Retry(space_or_tab_with_options(
tokenizer,
SpaceOrTabOptions {
kind: Name::HtmlFlowData,
@@ -146,9 +147,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State {
connect: false,
content_type: None,
},
- );
-
- tokenizer.attempt(name, State::Next(StateName::HtmlFlowBefore), State::Nok)
+ ))
} else {
State::Nok
}
@@ -632,10 +631,10 @@ pub fn continuation(tokenizer: &mut Tokenizer) -> State {
{
tokenizer.exit(Name::HtmlFlowData);
tokenizer.check(
- StateName::HtmlFlowBlankLineBefore,
State::Next(StateName::HtmlFlowContinuationAfter),
State::Next(StateName::HtmlFlowContinuationStart),
- )
+ );
+ State::Retry(StateName::HtmlFlowBlankLineBefore)
}
// Note: important that this is after the basic/complete case.
None | Some(b'\n') => {
@@ -678,10 +677,10 @@ pub fn continuation(tokenizer: &mut Tokenizer) -> State {
/// ```
pub fn continuation_start(tokenizer: &mut Tokenizer) -> State {
tokenizer.check(
- StateName::NonLazyContinuationStart,
State::Next(StateName::HtmlFlowContinuationStartNonLazy),
State::Next(StateName::HtmlFlowContinuationAfter),
- )
+ );
+ State::Retry(StateName::NonLazyContinuationStart)
}
/// In continuation, at an eol, before non-lazy content.