diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 14:53:42 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 14:53:42 +0200 |
commit | d87dc75500a2e73d9521135054b42c18e6eae987 (patch) | |
tree | 4bc3f4a72894db3ec5ed4069841c6be5be69713d /src/util/slice.rs | |
parent | 6eb2f644057f371841fe25330a57ee185f91c7af (diff) | |
download | markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.tar.gz markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.tar.bz2 markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.zip |
Refactor to move some code to `event.rs`
Diffstat (limited to 'src/util/slice.rs')
-rw-r--r-- | src/util/slice.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util/slice.rs b/src/util/slice.rs index f287978..34adf32 100644 --- a/src/util/slice.rs +++ b/src/util/slice.rs @@ -1,7 +1,7 @@ //! Utilities to deal with characters. use crate::constant::TAB_SIZE; -use crate::tokenizer::{Event, EventType, Point}; +use crate::event::{Event, Kind, Point}; use std::str; /// A range between two places. @@ -24,15 +24,15 @@ impl<'a> Position<'a> { pub fn from_exit_event(events: &'a [Event], index: usize) -> Position<'a> { let exit = &events[index]; debug_assert_eq!( - exit.event_type, - EventType::Exit, + exit.kind, + Kind::Exit, "expected `from_exit_event` to be called on `exit` event" ); let mut enter_index = index - 1; loop { let enter = &events[enter_index]; - if enter.event_type == EventType::Enter && enter.token_type == exit.token_type { + if enter.kind == Kind::Enter && enter.name == exit.name { return Position { start: &enter.point, end: &exit.point, |