feat: custom node (#138)

* feat: custom node

* add zen template, expose $nodes and $root

* add custom handler to go and nodejs

* add support for python, improve bindings, add error to zen template

* fix: correct binding exports for nodejs and python

* fix benchmark

* improve rust api, trim template in zen templates

* update cargo action

* update expression version

* compile action

* fix action format
This commit is contained in:
stefan-gorules
2024-04-03 16:09:51 +02:00
committed by GitHub
parent 685a0345f5
commit daecf901e6
65 changed files with 1729 additions and 235 deletions
+1
View File
@@ -13,6 +13,7 @@ pub enum Node<'a> {
Array(&'a [&'a Node<'a>]),
Identifier(&'a str),
Closure(&'a Node<'a>),
Root,
Member {
node: &'a Node<'a>,
property: &'a Node<'a>,
+5 -1
View File
@@ -280,7 +280,11 @@ impl<'arena, 'token_ref, Flavor> Parser<'arena, 'token_ref, Flavor> {
self.next()?;
let current_token = self.current();
if current_token.kind != TokenKind::Bracket(Bracket::LeftParenthesis) {
let identifier_node = self.node(Node::Identifier(identifier_token.value));
let identifier_node = match identifier_token.kind {
TokenKind::Identifier(Identifier::RootReference) => self.node(Node::Root),
_ => self.node(Node::Identifier(identifier_token.value)),
};
return self
.with_postfix(identifier_node, expression_parser)
.map(Some);
+1
View File
@@ -214,6 +214,7 @@ impl From<&Node<'_>> for UnaryNodeBehaviour {
match value {
Node::Null => CompareWithReference(Equal),
Node::Root => CompareWithReference(Equal),
Node::Bool(_) => CompareWithReference(Equal),
Node::Number(_) => CompareWithReference(Equal),
Node::String(_) => CompareWithReference(Equal),