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/construct/attention.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/construct/attention.rs')
-rw-r--r-- | src/construct/attention.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/construct/attention.rs b/src/construct/attention.rs index a53a328..27d7544 100644 --- a/src/construct/attention.rs +++ b/src/construct/attention.rs @@ -168,11 +168,11 @@ struct Sequence { /// > | ** /// ^ /// ``` -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.attention => { tokenizer.enter(Token::AttentionSequence); - inside(tokenizer, code, MarkerKind::from_code(code)) + inside(tokenizer, MarkerKind::from_code(tokenizer.current)) } _ => State::Nok, } @@ -184,11 +184,11 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { /// > | ** /// ^^ /// ``` -fn inside(tokenizer: &mut Tokenizer, code: Code, marker: MarkerKind) -> State { - match code { +fn inside(tokenizer: &mut Tokenizer, marker: MarkerKind) -> State { + match tokenizer.current { Code::Char(char) if char == marker.as_char() => { - tokenizer.consume(code); - State::Fn(Box::new(move |t, c| inside(t, c, marker))) + tokenizer.consume(); + State::Fn(Box::new(move |t| inside(t, marker))) } _ => { tokenizer.exit(Token::AttentionSequence); |