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/string.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 '')
-rw-r--r-- | src/content/string.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/content/string.rs b/src/content/string.rs index 3338c90..53e88b1 100644 --- a/src/content/string.rs +++ b/src/content/string.rs @@ -33,9 +33,10 @@ const MARKERS: [Code; 2] = [ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::None => (State::Ok, None), - _ => tokenizer.attempt_2(character_reference, character_escape, |ok| { - Box::new(if ok { start } else { before_data }) - })(tokenizer, code), + _ => tokenizer.attempt_n( + vec![Box::new(character_reference), Box::new(character_escape)], + |ok| Box::new(if ok { start } else { before_data }), + )(tokenizer, code), } } |