use of org.beetl.core.statement.TernaryExpression in project beetl2.0 by javamonkey.
the class AntlrProgramBuilder method parseTernaryExpression.
protected Expression parseTernaryExpression(TernaryExpContext ctx) {
Expression cond = this.parseExpress(ctx.expression(0));
Expression a = this.parseExpress(ctx.expression(1));
Expression b = null;
if (ctx.COLON() == null) {
b = null;
} else {
b = this.parseExpress(ctx.expression(2));
}
TerminalNode tn = (TerminalNode) ctx.getChild(1);
return new TernaryExpression(cond, a, b, this.getBTToken(tn.getSymbol()));
}
Aggregations