From 0d9c4611922535533746d1a86f10ef4e701c950e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 11 Aug 2022 17:26:17 +0200 Subject: Refactor attempts to remove unneeded state name --- src/construct/html_flow.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/construct/html_flow.rs') 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. -- cgit