Package org.python.pydev.parser.jython.ast

Examples of org.python.pydev.parser.jython.ast.exprType


     * @see org.python.pydev.parser.jython.ast.VisitorBase#visitAssign(org.python.pydev.parser.jython.ast.Assign)
     */
    public Object visitAssign(Assign node) throws Exception {
        exprType[] targets = node.targets;
        for (int i = 0; i < targets.length; i++) {
            exprType t = targets[i];

            if (t instanceof Name) {
                //we are in the class declaration
                if (isInClassDecl()) {
                    //add the attribute for the class
View Full Code Here


    private static void visitTargetsInAssign(EasyAstIteratorBase visitor, exprType[] targets) {
        if (targets == null) {
            return;
        }
        for (int i = 0; i < targets.length; i++) {
            exprType t = targets[i];
            if (t instanceof Tuple) {
                Tuple tuple = (Tuple) t;
                visitTargetsInAssign(visitor, tuple.elts);
            }
            visitTargetInAssign(visitor, t);
View Full Code Here

     * @param ast2 the node to work with
     * @return the line definition of a node
     */
    public static int getLineDefinition(SimpleNode ast2) {
        while (ast2 instanceof Attribute) {
            exprType val = ((Attribute) ast2).value;
            if (!(val instanceof Call)) {
                ast2 = val;
            } else {
                break;
            }
View Full Code Here

     * @return the column definition of a node
     */
    public static int getColDefinition(SimpleNode ast2, boolean always1ForImports) {
        if (ast2 instanceof Attribute) {
            //if it is an attribute, we always have to move backward to the first defined token (Attribute.value)
            exprType value = ((Attribute) ast2).value;
            return getColDefinition(value);
        }

        //call and subscript are special cases, because they are not gotten directly (we have to go to the first
        //part of it (which in turn may be an attribute)
View Full Code Here

     */
    public static exprType makeAttribute(String attrString) {
        List<String> dotSplit = StringUtils.dotSplit(attrString);
        Assert.isTrue(dotSplit.size() > 1);

        exprType first = null;
        Attribute last = null;
        Attribute attr = null;
        for (int i = dotSplit.size() - 1; i > 0; i--) {
            Call call = null;
            String part = dotSplit.get(i);
View Full Code Here

                            return;
                        }
                    }
                } else if (newStmt instanceof Assign) {
                    Assign assign = (Assign) newStmt;
                    exprType target = assign.targets[0];

                    //an assign could be in a method or in a class depending on where we're right now...
                    int size = peek.size();
                    if (size > 0) {
                        stmtType existing = peek.get(size - 1);
View Full Code Here

    @Override
    public Object visitAssign(Assign node) throws Exception {
        fixNode(node);

        for (int i = 0; i < node.targets.length; i++) {
            exprType target = node.targets[i];
            target.accept(this);
            nextCol();
        }

        node.value.accept(this);
        nextCol();
View Full Code Here

        if (node.values != null) {
            for (int i = 0; i < node.values.length; i++) {
                if (i > 0 || node.dest != null) {

                }
                exprType value = node.values[i];
                if (value != null) {
                    value.accept(this);
                }
            }
        }
        fixAfterNode(node);
View Full Code Here

    public Object visitStrJoin(StrJoin node) throws Exception {

        fixNode(node);
        if (node.strs != null) {
            for (int i = 0; i < node.strs.length; i++) {
                exprType str = node.strs[i];
                if (str != null) {
                    str.accept(this);
                    nextLine(true);
                }
            }
        }
View Full Code Here

        int defaultsLen = d == null ? 0 : d.length;
        int diff = argsLen - defaultsLen;

        fixNode(completeArgs);
        for (int i = 0; i < argsLen; i++) {
            exprType argName = args[i];

            //this is something as >>var:int=10<<
            //handle argument
            argName.accept(this);

            //handle annotation
            if (anns != null) {
                exprType ann = anns[i];
                if (ann != null) {

                    ann.accept(this); //right after the '='
                }
            }

            //handle defaults
            if (i >= diff) {
                exprType defaulArgValue = d[i - diff];
                if (defaulArgValue != null) {

                    defaulArgValue.accept(this);
                }
            }

        }

        //varargs
        if (completeArgs.vararg != null) {
            completeArgs.vararg.accept(this);
            if (completeArgs.varargannotation != null) {

                completeArgs.varargannotation.accept(this);
            }

        }

        //keyword only arguments (after varargs)
        if (completeArgs.kwonlyargs != null) {
            for (int i = 0; i < completeArgs.kwonlyargs.length; i++) {
                exprType kwonlyarg = completeArgs.kwonlyargs[i];
                if (kwonlyarg != null) {

                    kwonlyarg.accept(this);

                    if (completeArgs.kwonlyargannotation != null && completeArgs.kwonlyargannotation[i] != null) {

                        completeArgs.kwonlyargannotation[i].accept(this);
                    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.exprType

Copyright © 2018 www.massapicom. 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.