From 021d5f989ae41ae39a9b937b498141d9dc70d894 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 9 Jun 2022 15:01:46 +0200 Subject: Add basic subtokenization, string content in fenced code --- src/util.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/util.rs') diff --git a/src/util.rs b/src/util.rs index 47359a3..5a916cd 100644 --- a/src/util.rs +++ b/src/util.rs @@ -165,12 +165,12 @@ pub fn get_span(events: &[Event], index: usize) -> Span { assert_eq!( exit.event_type, EventType::Exit, - "expected get_span to be called on `exit` event" + "expected `get_span` to be called on `exit` event" ); - let mut start_index = index - 1; + let mut enter_index = index - 1; loop { - let enter = &events[start_index]; + let enter = &events[enter_index]; if enter.event_type == EventType::Enter && enter.token_type == token_type { return Span { // start: enter.point.clone(), @@ -181,7 +181,7 @@ pub fn get_span(events: &[Event], index: usize) -> Span { }; } - start_index -= 1; + enter_index -= 1; } } -- cgit