aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/partial_data.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-20 18:00:52 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-20 18:00:52 +0200
commit75c2109c6051009b220436bd823970a374f4f9fd (patch)
treec8123e6e4a0a71e2daec77d76c0dc4485bad2240 /src/construct/partial_data.rs
parent86801cdb3b114b30a14d4b8c01c8fb70b2bcee82 (diff)
downloadmarkdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.tar.gz
markdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.tar.bz2
markdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.zip
Refactor to share edit map
Diffstat (limited to '')
-rw-r--r--src/construct/partial_data.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/construct/partial_data.rs b/src/construct/partial_data.rs
index b56efd2..ea71bcf 100644
--- a/src/construct/partial_data.rs
+++ b/src/construct/partial_data.rs
@@ -75,8 +75,7 @@ fn data(tokenizer: &mut Tokenizer, code: Code, stop: Vec<Code>) -> StateFnResult
}
/// Merge adjacent data events.
-pub fn resolve_data(tokenizer: &mut Tokenizer) {
- let mut edit_map = EditMap::new();
+pub fn resolve_data(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
let len = tokenizer.events.len();
let mut index = 0;
@@ -96,7 +95,7 @@ pub fn resolve_data(tokenizer: &mut Tokenizer) {
}
if exit_far_index > exit_index {
- edit_map.add(exit_index, exit_far_index - exit_index, vec![]);
+ map.add(exit_index, exit_far_index - exit_index, vec![]);
// Change positional info.
let exit_far = &tokenizer.events[exit_far_index];
@@ -114,5 +113,6 @@ pub fn resolve_data(tokenizer: &mut Tokenizer) {
index += 1;
}
- edit_map.consume(&mut tokenizer.events);
+ // This resolver helps, but is not required for other resolvers.
+ false
}