diff options
Diffstat (limited to 'crates/ra_syntax/src/parsing.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing.rs | 23 |
1 files changed, 3 insertions, 20 deletions
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 { | |||
69 | /// | 69 | /// |
70 | /// Hopefully this will allow us to treat text and token trees in the same way! | 70 | /// Hopefully this will allow us to treat text and token trees in the same way! |
71 | trait TokenSource { | 71 | trait TokenSource { |
72 | fn token_kind(&self, pos: TokenPos) -> SyntaxKind; | 72 | fn token_kind(&self, pos: usize) -> SyntaxKind; |
73 | fn is_token_joint_to_next(&self, pos: TokenPos) -> bool; | 73 | fn is_token_joint_to_next(&self, pos: usize) -> bool; |
74 | fn is_keyword(&self, pos: TokenPos, kw: &str) -> bool; | 74 | fn is_keyword(&self, pos: usize, kw: &str) -> bool; |
75 | } | ||
76 | |||
77 | #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Default)] | ||
78 | pub(crate) struct TokenPos(pub u32); | ||
79 | |||
80 | impl std::ops::Add<u32> for TokenPos { | ||
81 | type Output = TokenPos; | ||
82 | |||
83 | fn add(self, rhs: u32) -> TokenPos { | ||
84 | TokenPos(self.0 + rhs) | ||
85 | } | ||
86 | } | ||
87 | |||
88 | impl std::ops::AddAssign<u32> for TokenPos { | ||
89 | fn add_assign(&mut self, rhs: u32) { | ||
90 | self.0 += rhs | ||
91 | } | ||
92 | } | 75 | } |