rnix

Type Alias SyntaxToken

source
pub type SyntaxToken = SyntaxToken<NixLanguage>;

Aliased Type§

struct SyntaxToken { /* private fields */ }

Implementations

source§

impl<L> SyntaxToken<L>
where L: Language,

source

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.

source

pub fn kind(&self) -> <L as Language>::Kind

source

pub fn text_range(&self) -> TextRange

source

pub fn index(&self) -> usize

source

pub fn text(&self) -> &str

source

pub fn green(&self) -> &GreenTokenData

source

pub fn parent(&self) -> Option<SyntaxNode<L>>

source

pub fn ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>

👎Deprecated: use SyntaxToken::parent_ancestors instead

Iterator over all the ancestors of this token excluding itself.

source

pub fn parent_ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>

Iterator over all the ancestors of this token excluding itself.

source

pub fn next_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>

source

pub fn prev_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>

source

pub fn siblings_with_tokens( &self, direction: Direction, ) -> impl Iterator<Item = NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>

source

pub fn next_token(&self) -> Option<SyntaxToken<L>>

Next token in the tree (i.e, not necessary a sibling).

source

pub fn prev_token(&self) -> Option<SyntaxToken<L>>

Previous token in the tree (i.e, not necessary a sibling).

source

pub fn detach(&self)

Trait Implementations

source§

impl<L> Clone for SyntaxToken<L>
where L: Clone + Language,

source§

fn clone(&self) -> SyntaxToken<L>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<L> Debug for SyntaxToken<L>
where L: Language,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<L> Display for SyntaxToken<L>
where L: Language,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<L> From<SyntaxToken> for SyntaxToken<L>
where L: Language,

source§

fn from(raw: SyntaxToken) -> SyntaxToken<L>

Converts to this type from the input type.
source§

impl<L> Hash for SyntaxToken<L>
where L: Hash + Language,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<L> PartialEq for SyntaxToken<L>
where L: PartialEq + Language,

source§

fn eq(&self, other: &SyntaxToken<L>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<L> Eq for SyntaxToken<L>
where L: Eq + Language,

source§

impl<L> StructuralPartialEq for SyntaxToken<L>
where L: Language,