diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-22 14:43:42 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-22 14:43:42 +0200 |
commit | 33b69eb9189fb2fd0f731530285baf3ac20c5eb0 (patch) | |
tree | fb4ad9ad645192b67f01b4727136d0a298b71909 /src/content/text.rs | |
parent | 0fcfeaf05a95ea17763a72d91b6aa1c01843d067 (diff) | |
download | markdown-rs-33b69eb9189fb2fd0f731530285baf3ac20c5eb0.tar.gz markdown-rs-33b69eb9189fb2fd0f731530285baf3ac20c5eb0.tar.bz2 markdown-rs-33b69eb9189fb2fd0f731530285baf3ac20c5eb0.zip |
Refactor to improve tokenizer, add docs
Diffstat (limited to 'src/content/text.rs')
-rw-r--r-- | src/content/text.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/content/text.rs b/src/content/text.rs index 857e9a0..1224064 100644 --- a/src/content/text.rs +++ b/src/content/text.rs @@ -45,14 +45,16 @@ const MARKERS: [Code; 5] = [ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::None => (State::Ok, None), - _ => tokenizer.attempt_7( - character_reference, - character_escape, - hard_break_escape, - hard_break_trailing, - autolink, - html_text, - code_text, + _ => tokenizer.attempt_n( + vec![ + Box::new(character_reference), + Box::new(character_escape), + Box::new(hard_break_escape), + Box::new(hard_break_trailing), + Box::new(autolink), + Box::new(html_text), + Box::new(code_text), + ], |ok| Box::new(if ok { start } else { before_data }), )(tokenizer, code), } |