From 4c1f9b8d4e9ab9ba3b16d2b03f3c8bcc7f61706e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Feb 2019 22:58:56 +0300 Subject: remove TokenPos --- crates/ra_syntax/src/parsing.rs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'crates/ra_syntax/src/parsing.rs') diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs index f74c365d5..5de6ff8c1 100644 --- a/crates/ra_syntax/src/parsing.rs +++ b/crates/ra_syntax/src/parsing.rs @@ -69,24 +69,7 @@ trait TreeSink { /// /// Hopefully this will allow us to treat text and token trees in the same way! trait TokenSource { - fn token_kind(&self, pos: TokenPos) -> SyntaxKind; - fn is_token_joint_to_next(&self, pos: TokenPos) -> bool; - fn is_keyword(&self, pos: TokenPos, kw: &str) -> bool; -} - -#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Default)] -pub(crate) struct TokenPos(pub u32); - -impl std::ops::Add for TokenPos { - type Output = TokenPos; - - fn add(self, rhs: u32) -> TokenPos { - TokenPos(self.0 + rhs) - } -} - -impl std::ops::AddAssign for TokenPos { - fn add_assign(&mut self, rhs: u32) { - self.0 += rhs - } + fn token_kind(&self, pos: usize) -> SyntaxKind; + fn is_token_joint_to_next(&self, pos: usize) -> bool; + fn is_keyword(&self, pos: usize, kw: &str) -> bool; } -- cgit v1.2.3