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/list.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/list.rs')
-rw-r--r-- | src/construct/list.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/construct/list.rs b/src/construct/list.rs index 96113e6..7437d4a 100644 --- a/src/construct/list.rs +++ b/src/construct/list.rs @@ -52,7 +52,6 @@ use crate::construct::{ use crate::token::Token; use crate::tokenizer::{Code, EventType, State, Tokenizer}; use crate::util::{ - edit_map::EditMap, skip, span::{codes as codes_from_span, from_exit_event}, }; @@ -388,7 +387,7 @@ fn nok(_tokenizer: &mut Tokenizer, _code: Code) -> State { } /// Find adjacent list items with the same marker. -pub fn resolve_list_item(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { +pub fn resolve_list_item(tokenizer: &mut Tokenizer) { let mut index = 0; let mut balance = 0; let mut lists_wip: Vec<(Kind, usize, usize, usize)> = vec![]; @@ -483,12 +482,9 @@ pub fn resolve_list_item(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { list_start.token_type = token_type.clone(); list_end.token_type = token_type; - map.add(list_item.2, 0, vec![list_start]); - map.add(list_item.3 + 1, 0, vec![list_end]); + tokenizer.map.add(list_item.2, 0, vec![list_start]); + tokenizer.map.add(list_item.3 + 1, 0, vec![list_end]); index += 1; } - - // This resolver improves events, but is not needed by other resolvers. - false } |