diff options
Diffstat (limited to 'src/construct/thematic_break.rs')
-rw-r--r-- | src/construct/thematic_break.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/construct/thematic_break.rs b/src/construct/thematic_break.rs index d87778f..4159146 100644 --- a/src/construct/thematic_break.rs +++ b/src/construct/thematic_break.rs @@ -51,7 +51,7 @@ use super::partial_space_or_tab::{space_or_tab, space_or_tab_min_max}; use crate::constant::{TAB_SIZE, THEMATIC_BREAK_MARKER_COUNT_MIN}; use crate::token::Token; -use crate::tokenizer::{Code, State, StateFnResult, Tokenizer}; +use crate::tokenizer::{Code, State, Tokenizer}; /// Type of thematic break. #[derive(Debug, PartialEq)] @@ -134,7 +134,7 @@ struct Info { /// > | *** /// ^ /// ``` -pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { +pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State { let max = if tokenizer.parse_state.constructs.code_indented { TAB_SIZE - 1 } else { @@ -145,7 +145,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { tokenizer.enter(Token::ThematicBreak); tokenizer.go(space_or_tab_min_max(0, max), before)(tokenizer, code) } else { - (State::Nok, 0) + State::Nok } } @@ -155,7 +155,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// > | *** /// ^ /// ``` -fn before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { +fn before(tokenizer: &mut Tokenizer, code: Code) -> State { match code { Code::Char('*' | '-' | '_') => at_break( tokenizer, @@ -165,7 +165,7 @@ fn before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { size: 0, }, ), - _ => (State::Nok, 0), + _ => State::Nok, } } @@ -175,7 +175,7 @@ fn before(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// > | *** /// ^ /// ``` -fn at_break(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult { +fn at_break(tokenizer: &mut Tokenizer, code: Code, info: Info) -> State { match code { Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') if info.size >= THEMATIC_BREAK_MARKER_COUNT_MIN => @@ -183,13 +183,13 @@ fn at_break(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult tokenizer.exit(Token::ThematicBreak); // Feel free to interrupt. tokenizer.interrupt = false; - (State::Ok, if matches!(code, Code::None) { 0 } else { 1 }) + State::Ok(if matches!(code, Code::None) { 0 } else { 1 }) } Code::Char(char) if char == info.kind.as_char() => { tokenizer.enter(Token::ThematicBreakSequence); sequence(tokenizer, code, info) } - _ => (State::Nok, 0), + _ => State::Nok, } } @@ -199,12 +199,12 @@ fn at_break(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult /// > | *** /// ^ /// ``` -fn sequence(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> StateFnResult { +fn sequence(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> State { match code { Code::Char(char) if char == info.kind.as_char() => { tokenizer.consume(code); info.size += 1; - (State::Fn(Box::new(|t, c| sequence(t, c, info))), 0) + State::Fn(Box::new(|t, c| sequence(t, c, info))) } _ => { tokenizer.exit(Token::ThematicBreakSequence); |