Skip to main content

ToAst

Trait ToAst 

Source
pub trait ToAst {
    type Output;

    // Required method
    fn to_ast<I>(self, resolver: &I) -> Option<Self::Output>
       where I: Resolver<TokenKey> + ?Sized;
}
Expand description

Converts a concrete syntax tree (CST) node to its corresponding abstract syntax tree (AST) representation.

Required Associated Types§

Source

type Output

The target AST type that this CST node converts to.

Required Methods§

Source

fn to_ast<I>(self, resolver: &I) -> Option<Self::Output>
where I: Resolver<TokenKey> + ?Sized,

Attempts to convert this CST node to its corresponding AST representation.

Returns Some(ast_node) if the conversion is successful, or None if the CST node cannot be represented in the AST (e.g., due to syntax errors or unsupported constructs).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ToAst for BinaryExpr

Source§

impl ToAst for BlockExpr

Source§

impl ToAst for Break

Source§

impl ToAst for CatchArm

Source§

impl ToAst for ChainExpr

Source§

impl ToAst for Class

Source§

impl ToAst for Continue

Source§

impl ToAst for ElseBranch

Source§

impl ToAst for Enum

Source§

impl ToAst for EnumVariant

Source§

impl ToAst for EnumVariantField

Source§

impl ToAst for Expr

Source§

impl ToAst for ForLoop

Source§

impl ToAst for Function

Source§

impl ToAst for FunctionItem

Source§

impl ToAst for FunctionSignature

Source§

impl ToAst for IdentToken

Source§

impl ToAst for IfElse

Source§

impl ToAst for ImportStmt

Source§

impl ToAst for LiteralToken

Source§

impl ToAst for Match

Source§

impl ToAst for MatchArm

Source§

impl ToAst for MatchPat

Source§

impl ToAst for Modifiers

Source§

impl ToAst for Parameter

Source§

impl ToAst for ParenExpr

Source§

impl ToAst for Return

Source§

impl ToAst for Throw

Source§

impl ToAst for Trait

Source§

impl ToAst for TraitImpl

Source§

impl ToAst for TryCatch

Source§

impl ToAst for Type

Source§

impl ToAst for TypeAlias

Source§

impl ToAst for UnaryExpr

Source§

impl ToAst for VariableStmt

Source§

impl ToAst for While