aboutsummaryrefslogtreecommitdiffstats
path: root/src/subtokenize.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-21 15:44:49 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-21 15:44:49 +0200
commitc43ad9bfb9467627df1b40266ac7b0d570a55a62 (patch)
tree27d7b01048a2e161f055388cecaa6bf84e1c01a4 /src/subtokenize.rs
parent2d0dfe66d423e707b7de60d9bde0cec7933580fe (diff)
downloadmarkdown-rs-c43ad9bfb9467627df1b40266ac7b0d570a55a62.tar.gz
markdown-rs-c43ad9bfb9467627df1b40266ac7b0d570a55a62.tar.bz2
markdown-rs-c43ad9bfb9467627df1b40266ac7b0d570a55a62.zip
Refactor to move `index` field to `point`
Diffstat (limited to 'src/subtokenize.rs')
-rw-r--r--src/subtokenize.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/subtokenize.rs b/src/subtokenize.rs
index ad13022..1f4c6e3 100644
--- a/src/subtokenize.rs
+++ b/src/subtokenize.rs
@@ -75,7 +75,7 @@ pub fn subtokenize(events: &mut Vec<Event>, parse_state: &ParseState) -> bool {
// Index into `events` pointing to a chunk.
let mut link_index: Option<usize> = Some(index);
// Subtokenizer.
- let mut tokenizer = Tokenizer::new(event.point.clone(), event.index, parse_state);
+ let mut tokenizer = Tokenizer::new(event.point.clone(), parse_state);
// Substate.
let mut result: StateFnResult = (
State::Fn(Box::new(if link.content_type == ContentType::String {
@@ -92,12 +92,12 @@ pub fn subtokenize(events: &mut Vec<Event>, parse_state: &ParseState) -> bool {
let link_curr = enter.link.as_ref().expect("expected link");
assert_eq!(enter.event_type, EventType::Enter);
let span = span::Span {
- start_index: enter.index,
- end_index: events[index + 1].index,
+ start_index: enter.point.index,
+ end_index: events[index + 1].point.index,
};
if link_curr.previous != None {
- tokenizer.define_skip(&enter.point, enter.index);
+ tokenizer.define_skip(&enter.point);
}
let func: Box<StateFn> = match result.0 {
@@ -127,7 +127,7 @@ pub fn subtokenize(events: &mut Vec<Event>, parse_state: &ParseState) -> bool {
// Find the first event that starts after the end we’re looking
// for.
if subevent.event_type == EventType::Enter
- && subevent.index >= events[link_index + 1].index
+ && subevent.point.index >= events[link_index + 1].point.index
{
slices.push((link_index, slice_start));
slice_start = subindex;