aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/attention.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-22 15:03:15 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-22 15:03:15 +0200
commit41fc406af206e21014eaaba94bcf6b1854f892b3 (patch)
tree510f6e1d763643da9072f9cf7e097e777fdbd5b8 /src/construct/attention.rs
parent37fad739ba73d488d4c3652caee01f1ec5d0aaaa (diff)
downloadmarkdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.tar.gz
markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.tar.bz2
markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.zip
Refactor to pass ints instead of vecs around
Diffstat (limited to '')
-rw-r--r--src/construct/attention.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/construct/attention.rs b/src/construct/attention.rs
index 38164a8..42c0965 100644
--- a/src/construct/attention.rs
+++ b/src/construct/attention.rs
@@ -175,7 +175,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
tokenizer.enter(Token::AttentionSequence);
inside(tokenizer, code, MarkerKind::from_code(code))
}
- _ => (State::Nok, None),
+ _ => (State::Nok, 0),
}
}
@@ -189,12 +189,12 @@ fn inside(tokenizer: &mut Tokenizer, code: Code, marker: MarkerKind) -> StateFnR
match code {
Code::Char(char) if char == marker.as_char() => {
tokenizer.consume(code);
- (State::Fn(Box::new(move |t, c| inside(t, c, marker))), None)
+ (State::Fn(Box::new(move |t, c| inside(t, c, marker))), 0)
}
_ => {
tokenizer.exit(Token::AttentionSequence);
tokenizer.register_resolver("attention".to_string(), Box::new(resolve_attention));
- (State::Ok, Some(vec![code]))
+ (State::Ok, if matches!(code, Code::None) { 0 } else { 1 })
}
}
}