Skip to content

Commit c01308e

Browse files
committed
Add comprehensive Bex workflow processing framework
Introduces a suite of classes to handle Bex-based workflows. This includes support for parsing, evaluating, and managing Bex bindings, expressions, and execution contexts, as well as utilities for metrics tracking and compute step execution.
1 parent d57a3dc commit c01308e

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/main/java/blue/bex/compile/BexCompiler.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ private List<CompiledStatement> compileStatements(FrozenNode node, CompileScope
185185
}
186186

187187
private CompiledStatement compileStatement(FrozenNode statement, CompileScope scope, String pointer) {
188-
if (statement == null || statement.getProperties() == null) {
189-
throw new BexException("Statement must be an operator object");
188+
if (statement == null || statement.isEmptyNode()) {
189+
return sourceStatement(currentFunction, pointer, "$return", new ReturnStatement(null));
190+
}
191+
if (statement.getProperties() == null) {
192+
throw new BexException("Statement must be an operator object at " + pointer);
190193
}
191194
int count = 0;
192195
String op = null;
@@ -199,7 +202,7 @@ private CompiledStatement compileStatement(FrozenNode statement, CompileScope sc
199202
}
200203
}
201204
if (count != 1 || statement.getProperties().size() != 1) {
202-
throw new BexException("Statement must have exactly one $ operator");
205+
throw new BexException("Statement must have exactly one $ operator at " + pointer);
203206
}
204207
String bodyPointer = pointer + "/" + escape(op);
205208
CompiledStatement compiled;

src/main/java/blue/bex/value/BexNodeWriter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public static Node toNode(BexValue value) {
1919
if (value.isNull()) {
2020
return new Node();
2121
}
22+
if (value instanceof NodeBexValue || value instanceof FrozenNodeBexValue) {
23+
return value.toNode();
24+
}
2225
if (value.isScalar()) {
2326
return value.toNode();
2427
}

0 commit comments

Comments
 (0)