pub trait Node: Sealed {
    fn start_position(&self) -> Option<Position>;
fn end_position(&self) -> Option<Position>;
fn similar(&self, other: &Self) -> bool
    where
        Self: Sized
;
fn tokens(&self) -> Tokens<'_>Notable traits for Tokens<'a>impl<'a> Iterator for Tokens<'a> type Item = &'a TokenReference;; fn range(&self) -> Option<(Position, Position)> { ... }
fn surrounding_trivia(&self) -> (Vec<&Token>, Vec<&Token>) { ... } }
Expand description

Used to represent nodes such as tokens or function definitions

This trait is sealed and cannot be implemented for types outside of full-moon

Required methods

The start position of a node. None if can’t be determined

The end position of a node. None if it can’t be determined

Whether another node of the same type is the same as this one semantically, ignoring position

The token references that comprise a node

Provided methods

The full range of a node, if it has both start and end positions

The tokens surrounding a node that are ignored and not accessible through the node’s own accessors. Use this if you want to get surrounding comments or whitespace. Returns a tuple of the leading and trailing trivia.

Implementations on Foreign Types

Implementors