[][src]Trait full_moon::node::Node

pub trait Node: Sealed {
    fn start_position(&self) -> Option<Position>;
fn end_position(&self) -> Option<Position>;
fn similar(&self, other: &Self) -> bool; fn range(&self) -> Option<(Position, Position)> { ... }
fn surrounding_ignore_tokens<'ast, 'b>(
        &self,
        ast: &'b Ast<'ast>
    ) -> Option<(Vec<&'b Token<'ast>>, Vec<&'b Token<'ast>>)> { ... } }

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

fn start_position(&self) -> Option<Position>

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

fn end_position(&self) -> Option<Position>

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

fn similar(&self, other: &Self) -> bool

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

Loading content...

Provided methods

fn range(&self) -> Option<(Position, Position)>

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

fn surrounding_ignore_tokens<'ast, 'b>(
    &self,
    ast: &'b Ast<'ast>
) -> Option<(Vec<&'b Token<'ast>>, Vec<&'b Token<'ast>>)>

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. Return value is None if a token doesn't have both a start and end position. Otherwise, it is a tuple of two token vectors, first being the preceding and the second being the following.

Loading content...

Implementations on Foreign Types

impl<'_, T: Node> Node for &'_ T[src]

impl<'_, T: Node> Node for &'_ mut T[src]

impl<T: Node> Node for Option<T>[src]

impl<T: Node> Node for Vec<T>[src]

impl<A: Node, B: Node> Node for (A, B)[src]

Loading content...

Implementors

impl<'a> Node for BinOp<'a>[src]

impl<'a> Node for Call<'a>[src]

impl<'a> Node for Expression<'a>[src]

impl<'a> Node for Field<'a>[src]

impl<'a> Node for FunctionArgs<'a>[src]

impl<'a> Node for Index<'a>[src]

impl<'a> Node for LastStmt<'a>[src]

impl<'a> Node for Parameter<'a>[src]

impl<'a> Node for Prefix<'a>[src]

impl<'a> Node for Stmt<'a>[src]

impl<'a> Node for Suffix<'a>[src]

impl<'a> Node for UnOp<'a>[src]

impl<'a> Node for Value<'a>[src]

impl<'a> Node for Var<'a>[src]

impl<'a> Node for TokenReference<'a>[src]

impl<'a> Node for ContainedSpan<'a>[src]

impl<'a> Node for Assignment<'a>[src]

impl<'a> Node for BinOpRhs<'a>[src]

impl<'a> Node for Block<'a>[src]

impl<'a> Node for Do<'a>[src]

impl<'a> Node for ElseIf<'a>[src]

impl<'a> Node for FunctionBody<'a>[src]

impl<'a> Node for FunctionCall<'a>[src]

impl<'a> Node for FunctionDeclaration<'a>[src]

impl<'a> Node for FunctionName<'a>[src]

impl<'a> Node for GenericFor<'a>[src]

impl<'a> Node for If<'a>[src]

impl<'a> Node for LocalAssignment<'a>[src]

impl<'a> Node for LocalFunction<'a>[src]

impl<'a> Node for MethodCall<'a>[src]

impl<'a> Node for NumericFor<'a>[src]

impl<'a> Node for Repeat<'a>[src]

impl<'a> Node for Return<'a>[src]

impl<'a> Node for TableConstructor<'a>[src]

impl<'a> Node for VarExpression<'a>[src]

impl<'a> Node for While<'a>[src]

impl<'a> Node for Token<'a>[src]

impl<'a, T: Node> Node for Pair<'a, T>[src]

impl<'a, T: Node> Node for Punctuated<'a, T>[src]

Loading content...