Trait full_moon::node::Node

source ·
pub trait Node: Sealed {
    // Required methods
    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<'_> ;

    // Provided methods
    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§

source

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

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

source

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

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

source

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

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

source

fn tokens(&self) -> Tokens<'_>

The token references that comprise a node

Provided Methods§

source

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

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

source

fn surrounding_trivia(&self) -> (Vec<&Token>, Vec<&Token>)

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§

source§

impl<A: Node, B: Node> Node for (A, B)

source§

impl<T: Node> Node for Option<T>

source§

impl<T: Node> Node for &T

source§

impl<T: Node> Node for &mut T

source§

impl<T: Node> Node for Box<T>

source§

impl<T: Node> Node for Vec<T>

Implementors§

source§

impl Node for BinOp

source§

impl Node for Call

source§

impl Node for Expression

source§

impl Node for Field

source§

impl Node for FunctionArgs

source§

impl Node for Index

source§

impl Node for LastStmt

source§

impl Node for Parameter

source§

impl Node for Prefix

source§

impl Node for Stmt

source§

impl Node for Suffix

source§

impl Node for UnOp

source§

impl Node for Var

source§

impl Node for CompoundOp

Available on crate feature roblox only.
source§

impl Node for GenericParameterInfo

Available on crate feature roblox only.
source§

impl Node for IndexedTypeInfo

Available on crate feature roblox only.
source§

impl Node for TypeFieldKey

Available on crate feature roblox only.
source§

impl Node for TypeInfo

Available on crate feature roblox only.
source§

impl Node for Goto

Available on crate feature lua52 only.
source§

impl Node for Label

Available on crate feature lua52 only.
source§

impl Node for Attribute

Available on crate feature lua54 only.
source§

impl Node for ContainedSpan

source§

impl Node for Assignment

source§

impl Node for Ast

source§

impl Node for Block

source§

impl Node for Do

source§

impl Node for ElseIf

source§

impl Node for FunctionBody

source§

impl Node for FunctionCall

source§

impl Node for FunctionDeclaration

source§

impl Node for FunctionName

source§

impl Node for GenericFor

source§

impl Node for If

source§

impl Node for LocalAssignment

source§

impl Node for LocalFunction

source§

impl Node for MethodCall

source§

impl Node for NumericFor

source§

impl Node for Repeat

source§

impl Node for Return

source§

impl Node for TableConstructor

source§

impl Node for VarExpression

source§

impl Node for While

source§

impl Node for CompoundAssignment

Available on crate feature roblox only.
source§

impl Node for ElseIfExpression

Available on crate feature roblox only.
source§

impl Node for ExportedTypeDeclaration

Available on crate feature roblox only.
source§

impl Node for GenericDeclaration

Available on crate feature roblox only.
source§

impl Node for GenericDeclarationParameter

Available on crate feature roblox only.
source§

impl Node for IfExpression

Available on crate feature roblox only.
source§

impl Node for InterpolatedString

Available on crate feature roblox only.
source§

impl Node for InterpolatedStringSegment

Available on crate feature roblox only.
source§

impl Node for TypeArgument

Available on crate feature roblox only.
source§

impl Node for TypeAssertion

Available on crate feature roblox only.
source§

impl Node for TypeDeclaration

Available on crate feature roblox only.
source§

impl Node for TypeField

Available on crate feature roblox only.
source§

impl Node for TypeSpecifier

Available on crate feature roblox only.
source§

impl Node for TokenReference

source§

impl<T: Node> Node for Pair<T>

source§

impl<T: Node> Node for Punctuated<T>