Examples of ASTIdentifier


Examples of net.sf.lapg.parser.ast.AstIdentifier

    LiSymbol sym = symbolsMap.get(name);
    if(sym == null) {
      if(name.length() > 3 && name.endsWith("opt")) {
        sym = symbolsMap.get(name.substring(0, name.length()-3));
        if(sym != null) {
          LiSymbol symopt = create(new AstIdentifier(id.getName(), id.getInput(), id.getOffset(), id.getEndOffset()), sym.getType(), false);
          rules.add(new LiRule(symopt, new LiSymbolRef[0], null, null, null, id));
          rules.add(new LiRule(symopt, new LiSymbolRef[]{new LiSymbolRef(sym,null,null,null)}, null, null, null, id));
          return symopt;
        }
      }
View Full Code Here

Examples of org.apache.commons.jexl2.parser.ASTIdentifier

    /** {@inheritDoc} */
    public Object visit(ASTForeachStatement node, Object data) {
        Object result = null;
        /* first objectNode is the loop variable */
        ASTReference loopReference = (ASTReference) node.jjtGetChild(0);
        ASTIdentifier loopVariable = (ASTIdentifier) loopReference.jjtGetChild(0);
        /* second objectNode is the variable to iterate */
        Object iterableValue = node.jjtGetChild(1).jjtAccept(this, data);
        // make sure there is a value to iterate on and a statement to execute
        if (iterableValue != null && node.jjtGetNumChildren() >= 3) {
            /* third objectNode is the statement to execute */
 
View Full Code Here

Examples of org.apache.commons.jexl2.parser.ASTIdentifier

    /** {@inheritDoc} */
    public Object visit(ASTForeachStatement node, Object data) {
        Object result = null;
        /* first objectNode is the loop variable */
        ASTReference loopReference = (ASTReference) node.jjtGetChild(0);
        ASTIdentifier loopVariable = (ASTIdentifier) loopReference.jjtGetChild(0);
        /* second objectNode is the variable to iterate */
        Object iterableValue = node.jjtGetChild(1).jjtAccept(this, data);
        // make sure there is a value to iterate on and a statement to execute
        if (iterableValue != null && node.jjtGetNumChildren() >= 3) {
            /* third objectNode is the statement to execute */
 
View Full Code Here

Examples of org.apache.commons.jexl2.parser.ASTIdentifier

    public Object visit(ASTAssignment node, Object data) {
        // left contains the reference to assign to
        int register = -1;
        JexlNode left = node.jjtGetChild(0);
        if (left instanceof ASTIdentifier) {
            ASTIdentifier var = (ASTIdentifier) left;
            register = var.getRegister();
            if (register < 0) {
                throw new JexlException(left, "unknown variable " + left.image);
            }
        } else if (!(left instanceof ASTReference)) {
            throw new JexlException(left, "illegal assignment form 0");
        }
        // right is the value expression to assign
        Object right = node.jjtGetChild(1).jjtAccept(this, data);

        // determine initial object & property:
        JexlNode objectNode = null;
        Object object = register >= 0 ? registers[register] : null;
        JexlNode propertyNode = null;
        Object property = null;
        boolean isVariable = true;
        int v = 0;
        StringBuilder variableName = null;
        // 1: follow children till penultimate, resolve dot/array
        int last = left.jjtGetNumChildren() - 1;
        // check we are not assigning a register itself
        boolean isRegister = last < 0 && register >= 0;
        // start at 1 if register
        for (int c = register >= 0 ? 1 : 0; c < last; ++c) {
            objectNode = left.jjtGetChild(c);
            // evaluate the property within the object
            object = objectNode.jjtAccept(this, object);
            if (object != null) {
                continue;
            }
            isVariable &= objectNode instanceof ASTIdentifier
                    || (objectNode instanceof ASTNumberLiteral && ((ASTNumberLiteral) objectNode).isInteger());
            // if we get null back as a result, check for an ant variable
            if (isVariable) {
                if (v == 0) {
                    variableName = new StringBuilder(left.jjtGetChild(0).image);
                    v = 1;
                }
                for (; v <= c; ++v) {
                    variableName.append('.');
                    variableName.append(left.jjtGetChild(v).image);
                }
                object = context.get(variableName.toString());
                // disallow mixing ant & bean with same root; avoid ambiguity
                if (object != null) {
                    isVariable = false;
                }
            } else {
                throw new JexlException(objectNode, "illegal assignment form");
            }
        }
        // 2: last objectNode will perform assignement in all cases
        propertyNode = isRegister ? null : left.jjtGetChild(last);
        boolean antVar = false;
        if (propertyNode instanceof ASTIdentifier) {
            ASTIdentifier identifier = (ASTIdentifier) propertyNode;
            register = identifier.getRegister();
            if (register >= 0) {
                isRegister = true;
            } else {
                property = identifier.image;
                antVar = true;
View Full Code Here

Examples of org.apache.commons.jexl2.parser.ASTIdentifier

    /** {@inheritDoc} */
    public Object visit(ASTForeachStatement node, Object data) {
        Object result = null;
        /* first objectNode is the loop variable */
        ASTReference loopReference = (ASTReference) node.jjtGetChild(0);
        ASTIdentifier loopVariable = (ASTIdentifier) loopReference.jjtGetChild(0);
        int register = loopVariable.getRegister();
        /* second objectNode is the variable to iterate */
        Object iterableValue = node.jjtGetChild(1).jjtAccept(this, data);
        // make sure there is a value to iterate on and a statement to execute
        if (iterableValue != null && node.jjtGetNumChildren() >= 3) {
            /* third objectNode is the statement to execute */
 
View Full Code Here

Examples of org.apache.commons.jexl2.parser.ASTIdentifier

            } else {
                throw new JexlException(node, "attempting to call method on null");
            }
        }
        // objectNode 0 is the identifier (method name), the others are parameters.
        ASTIdentifier methodNode = (ASTIdentifier) node.jjtGetChild(0);
        return call(node, data, methodNode, 1);
    }
View Full Code Here

Examples of org.apache.commons.jexl2.parser.ASTIdentifier

    public Object visit(ASTFunctionNode node, Object data) {
        // objectNode 0 is the prefix
        String prefix = node.jjtGetChild(0).image;
        Object namespace = resolveNamespace(prefix, node);
        // objectNode 1 is the identifier , the others are parameters.
        ASTIdentifier functionNode = (ASTIdentifier) node.jjtGetChild(1);
        return call(node, namespace, functionNode, 2);
    }
View Full Code Here

Examples of org.jboss.as.cmp.ejbql.ASTIdentifier

        // get the entity at the end of this path
        JDBCEntityBridge entity = (JDBCEntityBridge) path.getEntity();

        // second arg is the identifier
        ASTIdentifier id = (ASTIdentifier) node.jjtGetChild(1);

        // get the alias
        String alias = aliasManager.getAlias(id.identifier);

        // add this path to the list of join paths so parent paths will be joined
View Full Code Here

Examples of org.jboss.as.cmp.ejbql.ASTIdentifier

    public Object visit(ASTRangeVariableDeclaration node, Object data) {
        StringBuffer buf = (StringBuffer) data;

        ASTAbstractSchema schema = (ASTAbstractSchema) node.jjtGetChild(0);
        JDBCEntityBridge entity = (JDBCEntityBridge) schema.entity;
        ASTIdentifier id = (ASTIdentifier) node.jjtGetChild(1);

        String alias = aliasManager.getAlias(id.identifier);
        buf.append(entity.getQualifiedTableName())
                .append(' ')
                .append(alias);
View Full Code Here

Examples of org.jboss.as.cmp.ejbql.ASTIdentifier

    public Object visit(ASTCollectionMemberDeclaration node, Object data) {
        ASTPath path = (ASTPath) node.jjtGetChild(0);

        // assign the same alias for path and identifier
        ASTIdentifier id = (ASTIdentifier) node.jjtGetChild(1);
        String alias = aliasManager.getAlias(id.identifier);
        aliasManager.addAlias(path.getPath(), alias);

        addInnerJoinPath(path);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.