pub fn from(node: rnix::parser::Node<R>) -> Self {
        macro_rules! match_expr {
            ( $($node:tt),* else($elvar:ident) $el:expr ) => {
                match node.kind() {
                    $(
                    NodeType::$node => RawExpr::$node($node::cast(node).unwrap()),
                    )*

                    $elvar => $el
                }
            };
        }

        match_expr!(
            Apply, Assert, IfElse, IndexSet, Lambda, LetIn, List, Operation, Unary,
            OrDefault, Paren, Set, With, Interpol

            else(kind) {
                match kind {
                    // Ident = NodeType::Token(Token::Ident(_))
                    NodeType::Token(Token::Ident) => RawExpr::Ident(Ident::cast(node).unwrap()),
                    // Value = ???
                    NodeType::Token(t) if t.is_value() => RawExpr::Value(Value::cast(node).unwrap()),
                    _ => panic!("unexpected AST node kind: {:?} (expected expression)", kind),
                }
            }
        )
    }
/// Converts a raw AST node to an `Expr` node.
///
/// If `node` is not a valid expression node, this function will panic.
Converts a raw AST node to an `Expr` node.
If `node` is not a valid expression node, this function will panic.
Converts a raw AST node to an ` Expr ` node . If ` node ` is not a valid expression node this function will panic .
pub fn from(node: rnix::parser::Node<R>) -> Self {
        macro_rules! match_expr {
            ( $($node:tt),* else($elvar:ident) $el:expr ) => {
                match node.kind() {
                    $(
                    NodeType::$node => RawExpr::$node($node::cast(node).unwrap()),
                    )*
                    $elvar => $el
                }
            };
        }
        match_expr!(
            Apply, Assert, IfElse, IndexSet, Lambda, LetIn, List, Operation, Unary,
            OrDefault, Paren, Set, With, Interpol
            else(kind) {
                match kind {
                    // Ident = NodeType::Token(Token::Ident(_))
                    NodeType::Token(Token::Ident) => RawExpr::Ident(Ident::cast(node).unwrap()),
                    // Value = ???
                    NodeType::Token(t) if t.is_value() => RawExpr::Value(Value::cast(node).unwrap()),
                    _ => panic!("unexpected AST node kind: {:?} (expected expression)", kind),
                }
            }
        )
    }
pub fn from ( node : rnix :: parser :: Node < R > ) -> Self { macro_rules! match_expr { ( $ ( $node : tt ) * else ( $elvar : ident ) $el : expr ) => { match node kind ( ) { $ ( NodeType $node RawExpr $node ( $node cast ( node ) unwrap ( ) ) ) * $elvar $el } } ; } match_expr ! ( Apply Assert IfElse IndexSet Lambda LetIn List Operation Unary OrDefault Paren Set With Interpol else ( kind ) { match kind { // Ident = NodeType::Token(Token::Ident(_)) NodeType Token ( Token Ident ) RawExpr Ident ( Ident cast ( node ) unwrap ( ) ) // Value = ??? NodeType Token ( t ) if t is_value ( ) RawExpr Value ( Value cast ( node ) unwrap ( ) ) panic ( " " kind ) } } ) }
Converts a raw AST node to an `Expr` node.
Converts a raw AST node to an ` Expr ` node .
node
rnix::parser::Node<R>
node
rnix::parser::Node<R>