From 5ee6edf222658e73ee97871972b6fbeef444451b Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 25 Jul 2022 17:42:20 +0200 Subject: Refactor to not pass codes around --- src/content/text.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/content/text.rs') 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) } -- cgit