pub struct SyntaxToken { /* private fields */ }Expand description
Leaf token in the red syntax tree.
Implementations§
Source§impl SyntaxToken
impl SyntaxToken
Sourcepub fn kind(&self) -> SyntaxKind
pub fn kind(&self) -> SyntaxKind
Kind of this token.
Sourcepub fn text_range(&self) -> TextRange
pub fn text_range(&self) -> TextRange
The range that this token covers in the original text.
Sourcepub fn green(&self) -> &GreenToken
pub fn green(&self) -> &GreenToken
The underlying green token of this red token.
Sourcepub fn amber(&self) -> AmberToken<'_>
pub fn amber(&self) -> AmberToken<'_>
The corresponding amber token of this red token.
Sourcepub fn parent(&self) -> SyntaxNode
pub fn parent(&self) -> SyntaxNode
Parent of this token.
Sourcepub fn parent_ancestors(&self) -> impl Iterator<Item = SyntaxNode>
pub fn parent_ancestors(&self) -> impl Iterator<Item = SyntaxNode>
Iterator along the chain of parents of this token.
Sourcepub fn next_siblings(&self) -> impl Iterator<Item = SyntaxNode>
pub fn next_siblings(&self) -> impl Iterator<Item = SyntaxNode>
Nodes that come immediately after this token.
If you want to iterate over both nodes and tokens, use next_siblings_with_tokens instead.
Sourcepub fn next_sibling_or_token(
&self,
) -> Option<NodeOrToken<SyntaxNode, SyntaxToken>>
pub fn next_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode, SyntaxToken>>
Node or token that comes immediately after this token.
Sourcepub fn next_siblings_with_tokens(
&self,
) -> impl Iterator<Item = NodeOrToken<SyntaxNode, SyntaxToken>>
pub fn next_siblings_with_tokens( &self, ) -> impl Iterator<Item = NodeOrToken<SyntaxNode, SyntaxToken>>
Nodes and tokens that come immediately after this token.
Unlike rowan, the iterator doesn’t contain the current token itself.
Sourcepub fn next_consecutive_tokens(&self) -> impl Iterator<Item = SyntaxToken>
pub fn next_consecutive_tokens(&self) -> impl Iterator<Item = SyntaxToken>
Consecutive tokens sequence that come immediately after this token without any nodes in between.
Sourcepub fn prev_siblings(&self) -> impl Iterator<Item = SyntaxNode>
pub fn prev_siblings(&self) -> impl Iterator<Item = SyntaxNode>
Nodes that come immediately before this token.
If you want to iterate over both nodes and tokens, use prev_siblings_with_tokens instead.
Sourcepub fn prev_sibling_or_token(
&self,
) -> Option<NodeOrToken<SyntaxNode, SyntaxToken>>
pub fn prev_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode, SyntaxToken>>
Node or token that comes immediately before this token.
Sourcepub fn prev_siblings_with_tokens(
&self,
) -> impl Iterator<Item = NodeOrToken<SyntaxNode, SyntaxToken>>
pub fn prev_siblings_with_tokens( &self, ) -> impl Iterator<Item = NodeOrToken<SyntaxNode, SyntaxToken>>
Nodes and tokens that come immediately before this token.
Unlike rowan, the iterator doesn’t contain the current token itself.
Sourcepub fn prev_consecutive_tokens(&self) -> impl Iterator<Item = SyntaxToken>
pub fn prev_consecutive_tokens(&self) -> impl Iterator<Item = SyntaxToken>
Consecutive tokens sequence that come immediately before this token without any nodes in between.
Trait Implementations§
Source§impl Clone for SyntaxToken
impl Clone for SyntaxToken
Source§fn clone(&self) -> SyntaxToken
fn clone(&self) -> SyntaxToken
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more