aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/parsing.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-20 19:58:56 +0000
committerAleksey Kladov <[email protected]>2019-02-20 20:02:24 +0000
commit4c1f9b8d4e9ab9ba3b16d2b03f3c8bcc7f61706e (patch)
tree4e9ae2abecdf31bd849f3a6d5e568a495081f9a4 /crates/ra_syntax/src/parsing.rs
parentcce23fddba4241202ebd29cce44db4ce9a08793a (diff)
remove TokenPos
Diffstat (limited to 'crates/ra_syntax/src/parsing.rs')
-rw-r--r--crates/ra_syntax/src/parsing.rs23
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!
71trait TokenSource { 71trait 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)]
78pub(crate) struct TokenPos(pub u32);
79
80impl 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
88impl std::ops::AddAssign<u32> for TokenPos {
89 fn add_assign(&mut self, rhs: u32) {
90 self.0 += rhs
91 }
92} 75}