mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
remove TokenPos
This commit is contained in:
parent
cce23fddba
commit
4c1f9b8d4e
3 changed files with 28 additions and 49 deletions
|
@ -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<u32> for TokenPos {
|
||||
type Output = TokenPos;
|
||||
|
||||
fn add(self, rhs: u32) -> TokenPos {
|
||||
TokenPos(self.0 + rhs)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign<u32> 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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue