diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-25 17:42:20 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-25 17:42:20 +0200 |
commit | 5ee6edf222658e73ee97871972b6fbeef444451b (patch) | |
tree | c9233c7a8584a2d027ef1b7443e3e5b59918ca2b /src/content/text.rs | |
parent | 91dc4b1f461fa76df7163f68b2a6db361a71beea (diff) | |
download | markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.gz markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.bz2 markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.zip |
Refactor to not pass codes around
Diffstat (limited to 'src/content/text.rs')
-rw-r--r-- | src/content/text.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/content/text.rs b/src/content/text.rs index 4e49a3d..a9cf17c 100644 --- a/src/content/text.rs +++ b/src/content/text.rs @@ -45,8 +45,8 @@ const MARKERS: [Code; 12] = [ ]; /// Before text. -pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { - match code { +pub fn start(tokenizer: &mut Tokenizer) -> State { + match tokenizer.current { Code::None => State::Ok, _ => tokenizer.attempt_n( vec![ @@ -67,7 +67,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { let func = if ok { start } else { before_data }; Box::new(func) }, - )(tokenizer, code), + )(tokenizer), } } @@ -76,6 +76,6 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { /// ```markdown /// |qwe /// ``` -fn before_data(tokenizer: &mut Tokenizer, code: Code) -> State { - tokenizer.go(|t, c| data(t, c, &MARKERS), start)(tokenizer, code) +fn before_data(tokenizer: &mut Tokenizer) -> State { + tokenizer.go(|t| data(t, &MARKERS), start)(tokenizer) } |