diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 18:46:33 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 18:57:19 +0200 |
commit | bac358ee5c341729e50630f2569a69b4d580ce47 (patch) | |
tree | 9ea5f311dcad46e54dfaa55a2985c75925ff6c83 /src/construct/partial_data.rs | |
parent | 0525454e33ed6bcd7b43da1c0969c1d592e743d9 (diff) | |
download | markdown-rs-bac358ee5c341729e50630f2569a69b4d580ce47.tar.gz markdown-rs-bac358ee5c341729e50630f2569a69b4d580ce47.tar.bz2 markdown-rs-bac358ee5c341729e50630f2569a69b4d580ce47.zip |
Refactor to use a single shared edit map
Diffstat (limited to 'src/construct/partial_data.rs')
-rw-r--r-- | src/construct/partial_data.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/construct/partial_data.rs b/src/construct/partial_data.rs index 11064e6..d60ef36 100644 --- a/src/construct/partial_data.rs +++ b/src/construct/partial_data.rs @@ -8,7 +8,6 @@ use crate::token::Token; use crate::tokenizer::{Code, EventType, State, Tokenizer}; -use crate::util::edit_map::EditMap; /// At the beginning of data. /// @@ -75,7 +74,7 @@ fn data(tokenizer: &mut Tokenizer, code: Code, stop: &'static [Code]) -> State { } /// Merge adjacent data events. -pub fn resolve_data(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { +pub fn resolve_data(tokenizer: &mut Tokenizer) { let len = tokenizer.events.len(); let mut index = 0; @@ -95,7 +94,9 @@ pub fn resolve_data(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { } if exit_far_index > exit_index { - map.add(exit_index, exit_far_index - exit_index, vec![]); + tokenizer + .map + .add(exit_index, exit_far_index - exit_index, vec![]); // Change positional info. let exit_far = &tokenizer.events[exit_far_index]; @@ -108,7 +109,4 @@ pub fn resolve_data(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { index += 1; } - - // This resolver helps, but is not required for other resolvers. - false } |