pub type SyntaxToken = SyntaxToken<NixLanguage>;
Aliased Type§
struct SyntaxToken { /* private fields */ }
Implementations
source§impl<L> SyntaxToken<L>where
L: Language,
impl<L> SyntaxToken<L>where
L: Language,
sourcepub fn replace_with(&self, new_token: GreenToken) -> GreenNode
pub fn replace_with(&self, new_token: GreenToken) -> GreenNode
Returns a green tree, equal to the green tree this token belongs to, except with this token substituted. The complexity of the operation is proportional to the depth of the tree.
pub fn kind(&self) -> <L as Language>::Kind
pub fn text_range(&self) -> TextRange
pub fn index(&self) -> usize
pub fn text(&self) -> &str
pub fn green(&self) -> &GreenTokenData
pub fn parent(&self) -> Option<SyntaxNode<L>>
sourcepub fn ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
👎Deprecated: use SyntaxToken::parent_ancestors
instead
pub fn ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
SyntaxToken::parent_ancestors
insteadIterator over all the ancestors of this token excluding itself.
sourcepub fn parent_ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
pub fn parent_ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
Iterator over all the ancestors of this token excluding itself.
pub fn next_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn prev_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn siblings_with_tokens( &self, direction: Direction, ) -> impl Iterator<Item = NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
sourcepub fn next_token(&self) -> Option<SyntaxToken<L>>
pub fn next_token(&self) -> Option<SyntaxToken<L>>
Next token in the tree (i.e, not necessary a sibling).
sourcepub fn prev_token(&self) -> Option<SyntaxToken<L>>
pub fn prev_token(&self) -> Option<SyntaxToken<L>>
Previous token in the tree (i.e, not necessary a sibling).
pub fn detach(&self)
Trait Implementations
source§impl<L> Clone for SyntaxToken<L>
impl<L> Clone for SyntaxToken<L>
source§fn clone(&self) -> SyntaxToken<L>
fn clone(&self) -> SyntaxToken<L>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<L> Debug for SyntaxToken<L>where
L: Language,
impl<L> Debug for SyntaxToken<L>where
L: Language,
source§impl<L> Display for SyntaxToken<L>where
L: Language,
impl<L> Display for SyntaxToken<L>where
L: Language,
source§impl<L> From<SyntaxToken> for SyntaxToken<L>where
L: Language,
impl<L> From<SyntaxToken> for SyntaxToken<L>where
L: Language,
source§fn from(raw: SyntaxToken) -> SyntaxToken<L>
fn from(raw: SyntaxToken) -> SyntaxToken<L>
Converts to this type from the input type.