Search in sources :

Example 1 with IfStatement

use of org.beetl.core.statement.IfStatement in project beetl2.0 by javamonkey.

the class AntlrProgramBuilder method parseIf.

protected IfStatement parseIf(IfStContext ctx) {
    ParExpressionContext pe = ctx.parExpression();
    ExpressionContext expCtx = pe.expression();
    Expression exp = this.parseExpress(expCtx);
    StatementContext ifStatCtx = ctx.statement(0);
    Statement ifStat = this.parseStatment(ifStatCtx);
    StatementContext elseStatCtx = ctx.statement(1);
    Statement elseStat = null;
    if (elseStatCtx != null) {
        elseStat = this.parseStatment(elseStatCtx);
    }
    return new IfStatement(exp, ifStat, elseStat, this.getBTToken(ctx.If().getSymbol()));
}
Also used : IfStatement(org.beetl.core.statement.IfStatement) StatementExpressionContext(org.beetl.core.parser.BeetlParser.StatementExpressionContext) ExpressionContext(org.beetl.core.parser.BeetlParser.ExpressionContext) ParExpressionContext(org.beetl.core.parser.BeetlParser.ParExpressionContext) ContentBodyExpression(org.beetl.core.statement.ContentBodyExpression) ArthExpression(org.beetl.core.statement.ArthExpression) JsonMapExpression(org.beetl.core.statement.JsonMapExpression) CompareExpression(org.beetl.core.statement.CompareExpression) FunctionExpression(org.beetl.core.statement.FunctionExpression) IncDecExpression(org.beetl.core.statement.IncDecExpression) Expression(org.beetl.core.statement.Expression) AndExpression(org.beetl.core.statement.AndExpression) StatementExpression(org.beetl.core.statement.StatementExpression) NativeCallExpression(org.beetl.core.statement.NativeCallExpression) NegExpression(org.beetl.core.statement.NegExpression) FormatExpression(org.beetl.core.statement.FormatExpression) TernaryExpression(org.beetl.core.statement.TernaryExpression) OrExpression(org.beetl.core.statement.OrExpression) JsonArrayExpression(org.beetl.core.statement.JsonArrayExpression) NotBooleanExpression(org.beetl.core.statement.NotBooleanExpression) ContinueStatement(org.beetl.core.statement.ContinueStatement) DirectiveStatement(org.beetl.core.statement.DirectiveStatement) WhileStatement(org.beetl.core.statement.WhileStatement) AjaxStatement(org.beetl.core.statement.AjaxStatement) BreakStatement(org.beetl.core.statement.BreakStatement) ReturnStatement(org.beetl.core.statement.ReturnStatement) TagVarBindingStatement(org.beetl.core.statement.TagVarBindingStatement) EndStatement(org.beetl.core.statement.EndStatement) VarAssignStatement(org.beetl.core.statement.VarAssignStatement) GeneralForStatement(org.beetl.core.statement.GeneralForStatement) Statement(org.beetl.core.statement.Statement) BlockStatement(org.beetl.core.statement.BlockStatement) IfStatement(org.beetl.core.statement.IfStatement) ForStatement(org.beetl.core.statement.ForStatement) SwitchStatement(org.beetl.core.statement.SwitchStatement) TagStatement(org.beetl.core.statement.TagStatement) VarRefAssignStatement(org.beetl.core.statement.VarRefAssignStatement) SelectStatement(org.beetl.core.statement.SelectStatement) TryCatchStatement(org.beetl.core.statement.TryCatchStatement) ParExpressionContext(org.beetl.core.parser.BeetlParser.ParExpressionContext) StatementContext(org.beetl.core.parser.BeetlParser.StatementContext)

Aggregations

ExpressionContext (org.beetl.core.parser.BeetlParser.ExpressionContext)1 ParExpressionContext (org.beetl.core.parser.BeetlParser.ParExpressionContext)1 StatementContext (org.beetl.core.parser.BeetlParser.StatementContext)1 StatementExpressionContext (org.beetl.core.parser.BeetlParser.StatementExpressionContext)1 AjaxStatement (org.beetl.core.statement.AjaxStatement)1 AndExpression (org.beetl.core.statement.AndExpression)1 ArthExpression (org.beetl.core.statement.ArthExpression)1 BlockStatement (org.beetl.core.statement.BlockStatement)1 BreakStatement (org.beetl.core.statement.BreakStatement)1 CompareExpression (org.beetl.core.statement.CompareExpression)1 ContentBodyExpression (org.beetl.core.statement.ContentBodyExpression)1 ContinueStatement (org.beetl.core.statement.ContinueStatement)1 DirectiveStatement (org.beetl.core.statement.DirectiveStatement)1 EndStatement (org.beetl.core.statement.EndStatement)1 Expression (org.beetl.core.statement.Expression)1 ForStatement (org.beetl.core.statement.ForStatement)1 FormatExpression (org.beetl.core.statement.FormatExpression)1 FunctionExpression (org.beetl.core.statement.FunctionExpression)1 GeneralForStatement (org.beetl.core.statement.GeneralForStatement)1 IfStatement (org.beetl.core.statement.IfStatement)1