mirror of
https://github.com/gorules/zen.git
synced 2026-10-04 08:02:28 +00:00
* 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
51 lines
1.0 KiB
Rust
51 lines
1.0 KiB
Rust
use rust_decimal::Decimal;
|
|
|
|
use crate::lexer::Operator;
|
|
use crate::parser::builtin::BuiltInFunction;
|
|
|
|
#[derive(Debug, PartialEq, Clone)]
|
|
pub enum Node<'a> {
|
|
Null,
|
|
Bool(bool),
|
|
Number(Decimal),
|
|
String(&'a str),
|
|
Pointer,
|
|
Array(&'a [&'a Node<'a>]),
|
|
Identifier(&'a str),
|
|
Closure(&'a Node<'a>),
|
|
Root,
|
|
Member {
|
|
node: &'a Node<'a>,
|
|
property: &'a Node<'a>,
|
|
},
|
|
Slice {
|
|
node: &'a Node<'a>,
|
|
from: Option<&'a Node<'a>>,
|
|
to: Option<&'a Node<'a>>,
|
|
},
|
|
Interval {
|
|
left: &'a Node<'a>,
|
|
right: &'a Node<'a>,
|
|
left_bracket: &'a str,
|
|
right_bracket: &'a str,
|
|
},
|
|
Conditional {
|
|
condition: &'a Node<'a>,
|
|
on_true: &'a Node<'a>,
|
|
on_false: &'a Node<'a>,
|
|
},
|
|
Unary {
|
|
node: &'a Node<'a>,
|
|
operator: Operator,
|
|
},
|
|
Binary {
|
|
left: &'a Node<'a>,
|
|
operator: Operator,
|
|
right: &'a Node<'a>,
|
|
},
|
|
BuiltIn {
|
|
kind: BuiltInFunction,
|
|
arguments: &'a [&'a Node<'a>],
|
|
},
|
|
}
|