From c43ad9bfb9467627df1b40266ac7b0d570a55a62 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 21 Jul 2022 15:44:49 +0200 Subject: Refactor to move `index` field to `point` --- src/content/document.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/content') diff --git a/src/content/document.rs b/src/content/document.rs index 46da830..1a0ffee 100644 --- a/src/content/document.rs +++ b/src/content/document.rs @@ -77,8 +77,8 @@ struct DocumentInfo { } /// Turn `codes` as the document content type into events. -pub fn document(parse_state: &mut ParseState, point: Point, index: usize) -> Vec { - let mut tokenizer = Tokenizer::new(point, index, parse_state); +pub fn document(parse_state: &mut ParseState, point: Point) -> Vec { + let mut tokenizer = Tokenizer::new(point, parse_state); tokenizer.push(&parse_state.codes, Box::new(start), true); @@ -464,7 +464,6 @@ fn exit_containers( token_type: token_type.clone(), // Note: positions are fixed later. point: tokenizer.point.clone(), - index: tokenizer.index, link: None, }); } @@ -514,18 +513,12 @@ fn resolve(tokenizer: &mut Tokenizer, info: &mut DocumentInfo) { } else { &tokenizer.point }; - let index_rel = if let Some(index) = first_line_ending_in_run { - tokenizer.events[index].index - } else { - tokenizer.index - }; let close_index = first_line_ending_in_run.unwrap_or(index); let mut subevent_index = 0; while subevent_index < after.len() { after[subevent_index].point = point_rel.clone(); - after[subevent_index].index = index_rel; subevent_index += 1; } -- cgit