//! test utils use nom::IResult; use rowan::{ast::AstNode, SyntaxNode}; use crate::{ syntax::{combinator::GreenElement, input::Input}, ParseConfig, }; pub fn to_ast( parser: impl Fn(Input) -> IResult, ) -> impl Fn(&str) -> N { move |s: &str| { let input = Input { s, c: &ParseConfig::default(), }; let element = parser(input).unwrap().1; let node = element.into_node().unwrap(); let node = SyntaxNode::::new_root(node); AstNode::cast(node).unwrap() } }