From 92b42e06f943338ce8b54b7e22cbb116ff598fa6 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 7 Jul 2022 18:56:06 +0200 Subject: Refactor to move token types to `token` --- src/construct/partial_title.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/construct/partial_title.rs') diff --git a/src/construct/partial_title.rs b/src/construct/partial_title.rs index 010f554..6303da8 100644 --- a/src/construct/partial_title.rs +++ b/src/construct/partial_title.rs @@ -32,7 +32,8 @@ use super::partial_space_or_tab::{space_or_tab_eol_with_options, EolOptions}; use crate::subtokenize::link; -use crate::tokenizer::{Code, ContentType, State, StateFnResult, TokenType, Tokenizer}; +use crate::token::Token; +use crate::tokenizer::{Code, ContentType, State, StateFnResult, Tokenizer}; /// Configuration. /// @@ -40,11 +41,11 @@ use crate::tokenizer::{Code, ContentType, State, StateFnResult, TokenType, Token #[derive(Debug)] pub struct Options { /// Token for the whole title. - pub title: TokenType, + pub title: Token, /// Token for the marker. - pub marker: TokenType, + pub marker: Token, /// Token for the string inside the quotes. - pub string: TokenType, + pub string: Token, } /// Type of title. @@ -204,7 +205,7 @@ fn at_break(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> StateFnRes }, )(tokenizer, code), _ => { - tokenizer.enter_with_content(TokenType::Data, Some(ContentType::String)); + tokenizer.enter_with_content(Token::Data, Some(ContentType::String)); if info.connect { let index = tokenizer.events.len() - 1; @@ -226,11 +227,11 @@ fn at_break(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> StateFnRes fn title(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult { match code { Code::Char(char) if char == info.kind.as_char() => { - tokenizer.exit(TokenType::Data); + tokenizer.exit(Token::Data); at_break(tokenizer, code, info) } Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => { - tokenizer.exit(TokenType::Data); + tokenizer.exit(Token::Data); at_break(tokenizer, code, info) } Code::Char('\\') => { -- cgit