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/partial_whitespace.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 '')
-rw-r--r-- | src/construct/partial_whitespace.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/construct/partial_whitespace.rs b/src/construct/partial_whitespace.rs index 023c52f..afff1c4 100644 --- a/src/construct/partial_whitespace.rs +++ b/src/construct/partial_whitespace.rs @@ -27,7 +27,7 @@ use super::partial_space_or_tab::space_or_tab; use crate::tokenizer::{Code, State, Tokenizer}; /// Parse initial or final whitespace. -pub fn whitespace(tokenizer: &mut Tokenizer, code: Code) -> State { +pub fn whitespace(tokenizer: &mut Tokenizer) -> State { tokenizer.go( // Nothing if there’s no whitespace. space_or_tab(), @@ -41,22 +41,22 @@ pub fn whitespace(tokenizer: &mut Tokenizer, code: Code) -> State { // If there’s whitespace, and we were not at an eol/eof, there must be one here. at_eol }, - )(tokenizer, code) + )(tokenizer) } /// After whitespace, at an eol/eof. -fn at_eol(tokenizer: &mut Tokenizer, code: Code) -> State { +fn at_eol(tokenizer: &mut Tokenizer) -> State { if matches!( - code, + tokenizer.current, Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') ) { - ok(tokenizer, code) + ok(tokenizer) } else { State::Nok } } /// Fine. -fn ok(_tokenizer: &mut Tokenizer, _code: Code) -> State { +fn ok(_tokenizer: &mut Tokenizer) -> State { State::Ok } |