Search in sources :

Example 1 with VarAttributeArrayOrMapContext

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

the class AntlrProgramBuilder method parseVarAttribute.

protected VarAttribute[] parseVarAttribute(List<VarAttributeContext> list) {
    List<VarAttribute> listVarAttr = new ArrayList<VarAttribute>();
    for (VarAttributeContext vac : list) {
        if (vac instanceof VarAttributeGeneralContext) {
            VarAttributeGeneralContext zf = (VarAttributeGeneralContext) vac;
            VarAttribute attr = new VarAttribute(this.getBTToken(zf.Identifier().getSymbol()));
            listVarAttr.add(attr);
            attr.setAA(ObjectAA.defaultObjectAA());
        } else if (vac instanceof VarAttributeArrayOrMapContext) {
            VarAttributeArrayOrMapContext zf = (VarAttributeArrayOrMapContext) vac;
            Expression exp = this.parseExpress(zf.expression());
            VarSquareAttribute attr = new VarSquareAttribute(exp, this.getBTToken("[]", exp.token.line));
            attr.setAA(ObjectAA.defaultObjectAA());
            listVarAttr.add(attr);
        } else if (vac instanceof VarAttributeVirtualContext) {
            VarAttributeVirtualContext zf = (VarAttributeVirtualContext) vac;
            VarVirtualAttribute attr = new VarVirtualAttribute(this.getBTToken(zf.Identifier().getSymbol()));
            listVarAttr.add(attr);
        }
    }
    return listVarAttr.toArray(new VarAttribute[0]);
}
Also used : VarVirtualAttribute(org.beetl.core.statement.VarVirtualAttribute) VarAttributeGeneralContext(org.beetl.core.parser.BeetlParser.VarAttributeGeneralContext) VarSquareAttribute(org.beetl.core.statement.VarSquareAttribute) VarAttributeContext(org.beetl.core.parser.BeetlParser.VarAttributeContext) 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) VarAttribute(org.beetl.core.statement.VarAttribute) ArrayList(java.util.ArrayList) VarAttributeVirtualContext(org.beetl.core.parser.BeetlParser.VarAttributeVirtualContext) VarAttributeArrayOrMapContext(org.beetl.core.parser.BeetlParser.VarAttributeArrayOrMapContext)

Aggregations

ArrayList (java.util.ArrayList)1 VarAttributeArrayOrMapContext (org.beetl.core.parser.BeetlParser.VarAttributeArrayOrMapContext)1 VarAttributeContext (org.beetl.core.parser.BeetlParser.VarAttributeContext)1 VarAttributeGeneralContext (org.beetl.core.parser.BeetlParser.VarAttributeGeneralContext)1 VarAttributeVirtualContext (org.beetl.core.parser.BeetlParser.VarAttributeVirtualContext)1 AndExpression (org.beetl.core.statement.AndExpression)1 ArthExpression (org.beetl.core.statement.ArthExpression)1 CompareExpression (org.beetl.core.statement.CompareExpression)1 ContentBodyExpression (org.beetl.core.statement.ContentBodyExpression)1 Expression (org.beetl.core.statement.Expression)1 FormatExpression (org.beetl.core.statement.FormatExpression)1 FunctionExpression (org.beetl.core.statement.FunctionExpression)1 IncDecExpression (org.beetl.core.statement.IncDecExpression)1 JsonArrayExpression (org.beetl.core.statement.JsonArrayExpression)1 JsonMapExpression (org.beetl.core.statement.JsonMapExpression)1 NativeCallExpression (org.beetl.core.statement.NativeCallExpression)1 NegExpression (org.beetl.core.statement.NegExpression)1 NotBooleanExpression (org.beetl.core.statement.NotBooleanExpression)1 OrExpression (org.beetl.core.statement.OrExpression)1 StatementExpression (org.beetl.core.statement.StatementExpression)1