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/hard_break_trailing.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/construct/hard_break_trailing.rs') diff --git a/src/construct/hard_break_trailing.rs b/src/construct/hard_break_trailing.rs index 35a7cab..6626675 100644 --- a/src/construct/hard_break_trailing.rs +++ b/src/construct/hard_break_trailing.rs @@ -26,8 +26,8 @@ //! //! ## Tokens //! -//! * [`HardBreakTrailing`][TokenType::HardBreakTrailing] -//! * [`HardBreakTrailingSpace`][TokenType::HardBreakTrailingSpace] +//! * [`HardBreakTrailing`][Token::HardBreakTrailing] +//! * [`HardBreakTrailingSpace`][Token::HardBreakTrailingSpace] //! //! ## References //! @@ -41,7 +41,8 @@ //! [html]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-br-element use crate::constant::HARD_BREAK_PREFIX_SIZE_MIN; -use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer}; +use crate::token::Token; +use crate::tokenizer::{Code, State, StateFnResult, Tokenizer}; /// Start of a hard break (trailing). /// @@ -52,8 +53,8 @@ use crate::tokenizer::{Code, State, StateFnResult, TokenType, Tokenizer}; pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::Char(' ') => { - tokenizer.enter(TokenType::HardBreakTrailing); - tokenizer.enter(TokenType::HardBreakTrailingSpace); + tokenizer.enter(Token::HardBreakTrailing); + tokenizer.enter(Token::HardBreakTrailingSpace); tokenizer.consume(code); (State::Fn(Box::new(|t, c| inside(t, c, 1))), None) } @@ -79,8 +80,8 @@ fn inside(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnResult { Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') if size >= HARD_BREAK_PREFIX_SIZE_MIN => { - tokenizer.exit(TokenType::HardBreakTrailingSpace); - tokenizer.exit(TokenType::HardBreakTrailing); + tokenizer.exit(Token::HardBreakTrailingSpace); + tokenizer.exit(Token::HardBreakTrailing); (State::Ok, Some(vec![code])) } _ => (State::Nok, None), -- cgit