aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/hard_break_trailing.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-07 18:56:06 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-07 18:56:06 +0200
commit92b42e06f943338ce8b54b7e22cbb116ff598fa6 (patch)
treeff51df093f52dc33bfac5e1c236b41cfbd21c220 /src/construct/hard_break_trailing.rs
parentfdb1f1694f44cfbc59d303a10371300b48d74627 (diff)
downloadmarkdown-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/hard_break_trailing.rs15
1 files changed, 8 insertions, 7 deletions
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),