From 92b42e06f943338ce8b54b7e22cbb116ff598fa6 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 7 Jul 2022 18:56:06 +0200 Subject: Refactor to move token types to `token` --- src/util/skip.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/util') diff --git a/src/util/skip.rs b/src/util/skip.rs index a8e4cfe..971beb6 100644 --- a/src/util/skip.rs +++ b/src/util/skip.rs @@ -1,14 +1,15 @@ //! Utilities to deal with lists of events. -use crate::tokenizer::{Event, TokenType}; +use crate::token::Token; +use crate::tokenizer::Event; /// Skip from `index`, optionally past `token_types`. -pub fn opt(events: &[Event], index: usize, token_types: &[TokenType]) -> usize { +pub fn opt(events: &[Event], index: usize, token_types: &[Token]) -> usize { skip_opt_with_direction(events, index, token_types, true) } /// Skip from `index`, optionally past `token_types`, backwards. -pub fn opt_back(events: &[Event], index: usize, token_types: &[TokenType]) -> usize { +pub fn opt_back(events: &[Event], index: usize, token_types: &[Token]) -> usize { skip_opt_with_direction(events, index, token_types, false) } @@ -16,7 +17,7 @@ pub fn opt_back(events: &[Event], index: usize, token_types: &[TokenType]) -> us fn skip_opt_with_direction( events: &[Event], index: usize, - token_types: &[TokenType], + token_types: &[Token], forward: bool, ) -> usize { let mut index = index; -- cgit