aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/partial_space_or_tab.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-09 14:04:27 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-09 14:04:27 +0200
commit8f8d72a749a39845fd03ae259533abe73dc7dcdf (patch)
treeebc54d404f5a5e7e406f6323131dae1ed7a79c50 /src/construct/partial_space_or_tab.rs
parentfafcfd55e5f7ea8b87cab4bbf979730d81749402 (diff)
downloadmarkdown-rs-8f8d72a749a39845fd03ae259533abe73dc7dcdf.tar.gz
markdown-rs-8f8d72a749a39845fd03ae259533abe73dc7dcdf.tar.bz2
markdown-rs-8f8d72a749a39845fd03ae259533abe73dc7dcdf.zip
Add support for passing `ok`, `nok` as separate states to attempts
Diffstat (limited to 'src/construct/partial_space_or_tab.rs')
-rw-r--r--src/construct/partial_space_or_tab.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/construct/partial_space_or_tab.rs b/src/construct/partial_space_or_tab.rs
index b0b35a6..0b63b0e 100644
--- a/src/construct/partial_space_or_tab.rs
+++ b/src/construct/partial_space_or_tab.rs
@@ -180,13 +180,11 @@ pub fn eol_start(tokenizer: &mut Tokenizer) -> State {
},
);
- tokenizer.attempt(state_name, move |ok| {
- State::Fn(if ok {
- StateName::SpaceOrTabEolAfterFirst
- } else {
- StateName::SpaceOrTabEolAtEol
- })
- })
+ tokenizer.attempt(
+ state_name,
+ State::Fn(StateName::SpaceOrTabEolAfterFirst),
+ State::Fn(StateName::SpaceOrTabEolAtEol),
+ )
}
pub fn eol_after_first(tokenizer: &mut Tokenizer) -> State {
@@ -269,7 +267,11 @@ pub fn eol_after_eol(tokenizer: &mut Tokenizer) -> State {
connect: tokenizer.tokenize_state.space_or_tab_eol_connect,
},
);
- tokenizer.attempt_opt(state_name, StateName::SpaceOrTabEolAfterMore)
+ tokenizer.attempt(
+ state_name,
+ State::Fn(StateName::SpaceOrTabEolAfterMore),
+ State::Fn(StateName::SpaceOrTabEolAfterMore),
+ )
}
/// `space_or_tab_eol`: after more (optional) `space_or_tab`.