Type Definition cstree::syntax::SyntaxElement [−][src]
type SyntaxElement<L, D = ()> = NodeOrToken<SyntaxNode<L, D>, SyntaxToken<L, D>>;
An element of the tree, can be either a node or a token.
Implementations
impl<L: Language, D> SyntaxElement<L, D>
[src]
impl<L: Language, D> SyntaxElement<L, D>
[src]
pub fn text_range(&self) -> TextRange
[src]
The range this element covers in the source text, in bytes.
pub fn syntax_kind(&self) -> SyntaxKind
[src]
The internal representation of the kind of this element.
pub fn kind(&self) -> L::Kind
[src]
The kind of this element in terms of your language.
pub fn parent(&self) -> Option<&SyntaxNode<L, D>>
[src]
The parent node of this element, except if this element is the root.
pub fn ancestors(&self) -> impl Iterator<Item = &SyntaxNode<L, D>>
[src]
Returns an iterator along the chain of parents of this node.
pub fn first_token(&self) -> Option<&SyntaxToken<L, D>>
[src]
Return the leftmost token in the subtree of this element.
pub fn last_token(&self) -> Option<&SyntaxToken<L, D>>
[src]
Return the rightmost token in the subtree of this element.
pub fn next_sibling_or_token(&self) -> Option<SyntaxElementRef<'_, L, D>>
[src]
The tree element to the right of this one, i.e. the next child of this element’s parent after this element.
pub fn prev_sibling_or_token(&self) -> Option<SyntaxElementRef<'_, L, D>>
[src]
The tree element to the left of this one, i.e. the previous child of this element’s parent after this element.