aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/paragraph.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-25 17:42:20 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-25 17:42:20 +0200
commit5ee6edf222658e73ee97871972b6fbeef444451b (patch)
treec9233c7a8584a2d027ef1b7443e3e5b59918ca2b /src/construct/paragraph.rs
parent91dc4b1f461fa76df7163f68b2a6db361a71beea (diff)
downloadmarkdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.gz
markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.tar.bz2
markdown-rs-5ee6edf222658e73ee97871972b6fbeef444451b.zip
Refactor to not pass codes around
Diffstat (limited to 'src/construct/paragraph.rs')
-rw-r--r--src/construct/paragraph.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/construct/paragraph.rs b/src/construct/paragraph.rs
index d320779..4bce6a4 100644
--- a/src/construct/paragraph.rs
+++ b/src/construct/paragraph.rs
@@ -42,15 +42,15 @@ use crate::util::skip::opt as skip_opt;
/// > | abc
/// ^
/// ```
-pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
- match code {
+pub fn start(tokenizer: &mut Tokenizer) -> State {
+ match tokenizer.current {
Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => {
unreachable!("unexpected eol/eof")
}
_ => {
tokenizer.enter(Token::Paragraph);
tokenizer.enter_with_content(Token::Data, Some(ContentType::Text));
- inside(tokenizer, code)
+ inside(tokenizer)
}
}
}
@@ -61,8 +61,8 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
/// > | abc
/// ^^^
/// ```
-fn inside(tokenizer: &mut Tokenizer, code: Code) -> State {
- match code {
+fn inside(tokenizer: &mut Tokenizer) -> State {
+ match tokenizer.current {
Code::None | Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => {
tokenizer.exit(Token::Data);
tokenizer.exit(Token::Paragraph);
@@ -72,7 +72,7 @@ fn inside(tokenizer: &mut Tokenizer, code: Code) -> State {
State::Ok
}
_ => {
- tokenizer.consume(code);
+ tokenizer.consume();
State::Fn(Box::new(inside))
}
}