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/partial_whitespace.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/construct/partial_whitespace.rs') 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 } -- cgit