diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-20 18:00:52 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-20 18:00:52 +0200 |
commit | 75c2109c6051009b220436bd823970a374f4f9fd (patch) | |
tree | c8123e6e4a0a71e2daec77d76c0dc4485bad2240 /src/construct/partial_data.rs | |
parent | 86801cdb3b114b30a14d4b8c01c8fb70b2bcee82 (diff) | |
download | markdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.tar.gz markdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.tar.bz2 markdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.zip |
Refactor to share edit map
Diffstat (limited to 'src/construct/partial_data.rs')
-rw-r--r-- | src/construct/partial_data.rs | 8 |
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 } |