Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tokio = "1"
tokio-util = "0.7"
once_cell = "1"
petgraph = "0.8"
recursive = "0.1"
regex = "1"
regex-lite = "0.1"
strum = "0.27"
Expand Down
6 changes: 4 additions & 2 deletions core/expression/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ chrono-tz = "0.10"
humantime = { workspace = true }
fastrand = { workspace = true }
once_cell = { workspace = true }
recursive = { workspace = true, optional = true }
regex = { workspace = true, optional = true }
regex-lite = { workspace = true, optional = true }
serde = { workspace = true, features = ["rc", "derive"] }
Expand All @@ -35,9 +36,10 @@ csv = "1"
serde_json5 = "0.2"

[features]
default = ["regex-deprecated"]
regex-deprecated = ["dep:regex"]
default = ["regex-deprecated", "stack-protection"]
regex-lite = ["dep:regex-lite"]
regex-deprecated = ["dep:regex"]
stack-protection = ["dep:recursive"]

[[bench]]
harness = false
Expand Down
2 changes: 2 additions & 0 deletions core/expression/src/compiler/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ impl<'arena, 'bytecode_ref> CompilerInner<'arena, 'bytecode_ref> {
self.compile_node(arg)
}

#[cfg_attr(feature = "stack-protection", recursive::recursive)]
fn compile_member_fast(&mut self, node: &'arena Node<'arena>) -> Option<Vec<FetchFastTarget>> {
match node {
Node::Root => Some(vec![FetchFastTarget::Root]),
Expand Down Expand Up @@ -141,6 +142,7 @@ impl<'arena, 'bytecode_ref> CompilerInner<'arena, 'bytecode_ref> {
}
}

#[cfg_attr(feature = "stack-protection", recursive::recursive)]
fn compile_node(&mut self, node: &'arena Node<'arena>) -> CompilerResult<usize> {
match node {
Node::Null => Ok(self.emit(Opcode::PushNull)),
Expand Down
1 change: 1 addition & 0 deletions core/expression/src/intellisense/types/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl TypesProvider {
});
}

#[cfg_attr(feature = "stack-protection", recursive::recursive)]
fn determine(&mut self, node: &Node, scope: IntelliSenseScope) -> TypeInfo {
#[allow(non_snake_case)]
let V = |vt: VariableType| TypeInfo::from(vt);
Expand Down
1 change: 1 addition & 0 deletions core/expression/src/parser/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl<'arena, 'token_ref> Parser<'arena, 'token_ref, Standard> {
}
}

#[cfg_attr(feature = "stack-protection", recursive::recursive)]
fn binary_expression(&self, precedence: u8) -> &'arena Node<'arena> {
let mut node_left = self.unary_expression();
let Some(mut token) = self.current() else {
Expand Down
1 change: 1 addition & 0 deletions core/expression/src/parser/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl<'arena, 'token_ref> Parser<'arena, 'token_ref, Unary> {
left_node
}

#[cfg_attr(feature = "stack-protection", recursive::recursive)]
fn binary_expression(&self, precedence: u8, ctx: ParserContext) -> &'arena Node<'arena> {
let mut node_left = self.unary_expression();
let Some(mut token) = self.current() else {
Expand Down
11 changes: 9 additions & 2 deletions core/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ edition = "2021"
repository = "https://github.com/gorules/zen.git"

[dependencies]
zen-expression = { path = "../expression", version = "0.45.0" }
zen-expression = { path = "../expression", version = "0.45.0", default-features = false }
thiserror = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_json = { workspace = true }

[features]
default = ["stack-protection", "regex-deprecated"]

stack-protection = ["zen-expression/stack-protection"]
regex-lite = ["zen-expression/regex-lite"]
regex-deprecated = ["zen-expression/regex-deprecated"]
Loading