aboutsummaryrefslogtreecommitdiffstats
path: root/src/content/string.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/content/string.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 '')
-rw-r--r--src/content/string.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/content/string.rs b/src/content/string.rs
index 5a3149a..6d45f94 100644
--- a/src/content/string.rs
+++ b/src/content/string.rs
@@ -27,8 +27,8 @@ const MARKERS: [Code; 5] = [
];
/// Before string.
-pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
- match code {
+pub fn start(tokenizer: &mut Tokenizer) -> State {
+ match tokenizer.current {
Code::None => State::Ok,
_ => tokenizer.attempt_n(
vec![
@@ -40,11 +40,11 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> State {
let func = if ok { start } else { before_data };
Box::new(func)
},
- )(tokenizer, code),
+ )(tokenizer),
}
}
/// At data.
-fn before_data(tokenizer: &mut Tokenizer, code: Code) -> State {
- tokenizer.go(|t, c| data(t, c, &MARKERS), start)(tokenizer, code)
+fn before_data(tokenizer: &mut Tokenizer) -> State {
+ tokenizer.go(|t| data(t, &MARKERS), start)(tokenizer)
}