Search in sources :

Example 1 with AssignMentContext

use of org.beetl.core.parser.BeetlParser.AssignMentContext in project beetl2.0 by javamonkey.

the class AntlrProgramBuilder method parseVarDeclareList.

private VarAssignStatementSeq parseVarDeclareList(VarDeclareListContext ctx) {
    List<AssignMentContext> list = ctx.assignMent();
    List<ASTNode> listNode = new ArrayList<ASTNode>();
    for (AssignMentContext amc : list) {
        VarAssignStatement vas = this.parseAssign(amc);
        listNode.add(vas);
        if (!(vas instanceof VarRefAssignStatement)) {
            // 如果是临时变量定义
            this.registerNewVar(vas);
        }
    }
    VarAssignStatementSeq seq = new VarAssignStatementSeq(listNode.toArray(new Statement[0]), null);
    return seq;
}
Also used : VarAssignStatementSeq(org.beetl.core.statement.VarAssignStatementSeq) AssignMentContext(org.beetl.core.parser.BeetlParser.AssignMentContext) VarAssignStatement(org.beetl.core.statement.VarAssignStatement) 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) StaticTextByteASTNode(org.beetl.core.statement.StaticTextByteASTNode) ASTNode(org.beetl.core.statement.ASTNode) StaticTextASTNode(org.beetl.core.statement.StaticTextASTNode) ArrayList(java.util.ArrayList) VarRefAssignStatement(org.beetl.core.statement.VarRefAssignStatement)

Aggregations

ArrayList (java.util.ArrayList)1 AssignMentContext (org.beetl.core.parser.BeetlParser.AssignMentContext)1 ASTNode (org.beetl.core.statement.ASTNode)1 AjaxStatement (org.beetl.core.statement.AjaxStatement)1 BlockStatement (org.beetl.core.statement.BlockStatement)1 BreakStatement (org.beetl.core.statement.BreakStatement)1 ContinueStatement (org.beetl.core.statement.ContinueStatement)1 DirectiveStatement (org.beetl.core.statement.DirectiveStatement)1 EndStatement (org.beetl.core.statement.EndStatement)1 ForStatement (org.beetl.core.statement.ForStatement)1 GeneralForStatement (org.beetl.core.statement.GeneralForStatement)1 IfStatement (org.beetl.core.statement.IfStatement)1 ReturnStatement (org.beetl.core.statement.ReturnStatement)1 SelectStatement (org.beetl.core.statement.SelectStatement)1 Statement (org.beetl.core.statement.Statement)1 StaticTextASTNode (org.beetl.core.statement.StaticTextASTNode)1 StaticTextByteASTNode (org.beetl.core.statement.StaticTextByteASTNode)1 SwitchStatement (org.beetl.core.statement.SwitchStatement)1 TagStatement (org.beetl.core.statement.TagStatement)1 TagVarBindingStatement (org.beetl.core.statement.TagVarBindingStatement)1