diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-22 15:20:33 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-22 15:20:33 +0200 |
commit | 227e844154d9a592b80a88d7b8731d3d2f2fb3e2 (patch) | |
tree | 09d4243db0ae3d51c2420e70b9e364d470d520bd /src/construct/heading_setext.rs | |
parent | 6fdaffb3a8b4517a3b5c1e39dc1e16649c6eb0da (diff) | |
download | markdown-rs-227e844154d9a592b80a88d7b8731d3d2f2fb3e2.tar.gz markdown-rs-227e844154d9a592b80a88d7b8731d3d2f2fb3e2.tar.bz2 markdown-rs-227e844154d9a592b80a88d7b8731d3d2f2fb3e2.zip |
Add `attempt_opt` to tokenizer
Diffstat (limited to 'src/construct/heading_setext.rs')
-rw-r--r-- | src/construct/heading_setext.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs index 0cb8687..91e494d 100644 --- a/src/construct/heading_setext.rs +++ b/src/construct/heading_setext.rs @@ -56,7 +56,7 @@ //! [atx]: http://www.aaronsw.com/2002/atx/ use crate::constant::TAB_SIZE; -use crate::construct::partial_space_or_tab::space_or_tab_opt; +use crate::construct::partial_space_or_tab::space_or_tab; use crate::subtokenize::link; use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer}; use crate::util::span::from_exit_event; @@ -115,7 +115,7 @@ impl Kind { /// ``` pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { tokenizer.enter(TokenType::HeadingSetext); - tokenizer.go(space_or_tab_opt(), before)(tokenizer, code) + tokenizer.attempt_opt(space_or_tab(), before)(tokenizer, code) } /// Start of a heading (setext), after whitespace. @@ -183,7 +183,9 @@ fn text_continue(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { tokenizer.exit(TokenType::LineEnding); ( - State::Fn(Box::new(tokenizer.go(space_or_tab_opt(), text_line_start))), + State::Fn(Box::new( + tokenizer.attempt_opt(space_or_tab(), text_line_start), + )), None, ) } @@ -243,7 +245,7 @@ fn underline_before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { tokenizer.exit(TokenType::LineEnding); ( State::Fn(Box::new( - tokenizer.go(space_or_tab_opt(), underline_sequence_start), + tokenizer.attempt_opt(space_or_tab(), underline_sequence_start), )), None, ) @@ -298,7 +300,7 @@ fn underline_sequence_inside(tokenizer: &mut Tokenizer, code: Code, kind: Kind) None, ) } - _ => tokenizer.go(space_or_tab_opt(), underline_after)(tokenizer, code), + _ => tokenizer.attempt_opt(space_or_tab(), underline_after)(tokenizer, code), } } |