diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-07 18:56:06 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-07 18:56:06 +0200 |
commit | 92b42e06f943338ce8b54b7e22cbb116ff598fa6 (patch) | |
tree | ff51df093f52dc33bfac5e1c236b41cfbd21c220 /src/construct/html_text.rs | |
parent | fdb1f1694f44cfbc59d303a10371300b48d74627 (diff) | |
download | markdown-rs-92b42e06f943338ce8b54b7e22cbb116ff598fa6.tar.gz markdown-rs-92b42e06f943338ce8b54b7e22cbb116ff598fa6.tar.bz2 markdown-rs-92b42e06f943338ce8b54b7e22cbb116ff598fa6.zip |
Refactor to move token types to `token`
Diffstat (limited to '')
-rw-r--r-- | src/construct/html_text.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/construct/html_text.rs b/src/construct/html_text.rs index 0926f48..cdd7c69 100644 --- a/src/construct/html_text.rs +++ b/src/construct/html_text.rs @@ -42,8 +42,8 @@ //! //! ## Tokens //! -//! * [`HtmlText`][TokenType::HtmlText] -//! * [`HtmlTextData`][TokenType::HtmlTextData] +//! * [`HtmlText`][Token::HtmlText] +//! * [`HtmlTextData`][Token::HtmlTextData] //! //! ## References //! @@ -55,7 +55,8 @@ //! [html-parsing]: https://html.spec.whatwg.org/multipage/parsing.html#parsing use crate::construct::partial_space_or_tab::space_or_tab; -use crate::tokenizer::{Code, State, StateFn, StateFnResult, TokenType, Tokenizer}; +use crate::token::Token; +use crate::tokenizer::{Code, State, StateFn, StateFnResult, Tokenizer}; use crate::util::codes::parse; /// Start of HTML (text) @@ -65,8 +66,8 @@ use crate::util::codes::parse; /// ``` pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { if Code::Char('<') == code { - tokenizer.enter(TokenType::HtmlText); - tokenizer.enter(TokenType::HtmlTextData); + tokenizer.enter(Token::HtmlText); + tokenizer.enter(Token::HtmlTextData); tokenizer.consume(code); (State::Fn(Box::new(open)), None) } else { @@ -617,8 +618,8 @@ fn end(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { Code::Char('>') => { tokenizer.consume(code); - tokenizer.exit(TokenType::HtmlTextData); - tokenizer.exit(TokenType::HtmlText); + tokenizer.exit(Token::HtmlTextData); + tokenizer.exit(Token::HtmlText); (State::Ok, None) } _ => (State::Nok, None), @@ -641,10 +642,10 @@ fn at_line_ending( ) -> StateFnResult { match code { Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => { - tokenizer.exit(TokenType::HtmlTextData); - tokenizer.enter(TokenType::LineEnding); + tokenizer.exit(Token::HtmlTextData); + tokenizer.enter(Token::LineEnding); tokenizer.consume(code); - tokenizer.exit(TokenType::LineEnding); + tokenizer.exit(Token::LineEnding); ( State::Fn(Box::new(|t, c| after_line_ending(t, c, return_state))), None, @@ -687,6 +688,6 @@ fn after_line_ending_prefix( code: Code, return_state: Box<StateFn>, ) -> StateFnResult { - tokenizer.enter(TokenType::HtmlTextData); + tokenizer.enter(Token::HtmlTextData); return_state(tokenizer, code) } |