chore: add orgize-{cli,common,lsp} package

This commit is contained in:
PoiScript 2023-12-20 21:56:10 +08:00
parent 6930640866
commit 4cc1130a17
No known key found for this signature in database
GPG key ID: 22C2B1249D99985E
131 changed files with 6577 additions and 56 deletions

View file

@ -1,24 +0,0 @@
//! test utils
use nom::IResult;
use rowan::{ast::AstNode, SyntaxNode};
use crate::{
syntax::{combinator::GreenElement, input::Input},
ParseConfig,
};
pub fn to_ast<N: AstNode>(
parser: impl Fn(Input) -> IResult<Input, GreenElement, ()>,
) -> 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::<N::Language>::new_root(node);
AstNode::cast(node).unwrap()
}
}