use of org.mvel2.ast.OperatorNode in project mvel by mvel.
the class ExpressionCompiler method compileReduce.
private boolean compileReduce(int opCode, ASTLinkedList astBuild) {
switch(arithmeticFunctionReduction(opCode)) {
case -1:
/**
* The reduction failed because we encountered a non-literal,
* so we must now back out and cleanup.
*/
stk.xswap_op();
astBuild.addTokenNode(new LiteralNode(stk.pop(), pCtx));
astBuild.addTokenNode((OperatorNode) splitAccumulator.pop(), verify(pCtx, (ASTNode) splitAccumulator.pop()));
return false;
case -2:
/**
* Back out completely, pull everything back off the stack and add the instructions
* to the output payload as they are.
*/
LiteralNode rightValue = new LiteralNode(stk.pop(), pCtx);
OperatorNode operator = new OperatorNode((Integer) stk.pop(), expr, st, pCtx);
astBuild.addTokenNode(new LiteralNode(stk.pop(), pCtx), operator);
astBuild.addTokenNode(rightValue, (OperatorNode) splitAccumulator.pop());
astBuild.addTokenNode(verify(pCtx, (ASTNode) splitAccumulator.pop()));
}
return true;
}
Aggregations