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/construct/label_start_image.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/construct/label_start_image.rs') diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs index 54521d4..8c12ffe 100644 --- a/src/construct/label_start_image.rs +++ b/src/construct/label_start_image.rs @@ -38,12 +38,12 @@ use crate::tokenizer::{Code, LabelStart, State, Tokenizer}; /// > | a ![b] c /// ^ /// ``` -pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { - match code { +pub fn start(tokenizer: &mut Tokenizer) -> State { + match tokenizer.current { Code::Char('!') if tokenizer.parse_state.constructs.label_start_image => { tokenizer.enter(Token::LabelImage); tokenizer.enter(Token::LabelImageMarker); - tokenizer.consume(code); + tokenizer.consume(); tokenizer.exit(Token::LabelImageMarker); State::Fn(Box::new(open)) } @@ -57,11 +57,11 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { /// > | a ![b] c /// ^ /// ``` -pub fn open(tokenizer: &mut Tokenizer, code: Code) -> State { - match code { +pub fn open(tokenizer: &mut Tokenizer) -> State { + match tokenizer.current { Code::Char('[') => { tokenizer.enter(Token::LabelMarker); - tokenizer.consume(code); + tokenizer.consume(); tokenizer.exit(Token::LabelMarker); tokenizer.exit(Token::LabelImage); let end = tokenizer.events.len() - 1; -- cgit