Package org.python.pydev.parser.jython

Examples of org.python.pydev.parser.jython.SimpleNode.accept()


                                Log.log("Found node with beginLine <= 0:" + node + " line: " + node.beginLine);
                            }
                            return this;
                        }
                    };
                    lastNodeBeforePassedLine.accept(v);
                } catch (Exception e) {
                    Log.log(e);
                }
                if (line[0] != Integer.MAX_VALUE) {
                    lineForLocal = line[0];
View Full Code Here


        SimpleNode node = scope.getASTNode();

        LocalVariablesVisitor visitor = new LocalVariablesVisitor();
        try {
            node.accept(visitor);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        List<Name> variables = visitor.getVariables();
View Full Code Here

            return true; //we need it to be correctly parsed with an ast to be able to do it...
        }

        EasyASTIteratorVisitor visitor = new EasyASTIteratorVisitor();
        try {
            ast.accept(visitor);
        } catch (Exception e1) {
            Log.log(e1);
            return true; //just go on
        }
        List<ASTEntry> availableImports = visitor.getAsList(new Class[] { ImportFrom.class, Import.class });
View Full Code Here

                Log.log(e1);
            }

            GetNodeForExtractLocalVisitor visitor = new GetNodeForExtractLocalVisitor(startLineIndexInASTCoords);
            try {
                currentScope.accept(visitor);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            SimpleNode lastNodeBeforePassedLine = visitor.getLastInContextBeforePassedLine();
            if (lastNodeBeforePassedLine != null) {
View Full Code Here

        try {
            SimpleNode ast = module.getAst();
            if (ast != null) {
                if (nature.startRequests()) {
                    try {
                        ast.accept(visitor);
                    } finally {
                        nature.endRequests();
                    }
                }
            }
View Full Code Here

            s = sourceModule.getAst();
        }
        if (s != null) {
            FindScopeVisitor visitor = new FindScopeVisitor(state.getLine(), 0);
            try {
                s.accept(visitor);
                if (checkIfInCorrectScope) {
                    boolean scopeCorrect = false;

                    FastStack<SimpleNode> scopeStack = visitor.scope.getScopeStack();
                    for (Iterator<SimpleNode> it = scopeStack.topDownIterator(); scopeCorrect == false && it.hasNext();) {
View Full Code Here

    public Object visitAttribute(Attribute node) throws Exception {
        //we don't want to visit the 1st part (only the others)
        List<SimpleNode> attributeParts = NodeUtils.getAttributeParts(node);
        Iterator<SimpleNode> it = attributeParts.iterator();
        SimpleNode firstPart = it.next();
        firstPart.accept(this);

        Object ret = null;
        inAttr += 1;
        try {
            while (it.hasNext()) {
View Full Code Here

    private ILocalScope findLocalScope(String s, int line, int col) {
        SimpleNode ast = parseLegalDocStr(s);
        FindScopeVisitor scopeVisitor = new FindScopeVisitor(line, col);
        if (ast != null) {
            try {
                ast.accept(scopeVisitor);
            } catch (Exception e) {
                Log.log(e);
            }
        }
        ILocalScope localScope = scopeVisitor.scope;
View Full Code Here

        //Scramble the lines/columns
        SimpleNode copy = node.createCopy();
        MessLinesAndColumnsVisitor messLinesAndColumnsVisitor = new MessLinesAndColumnsVisitor();
        try {
            copy.accept(messLinesAndColumnsVisitor);
            MakeAstValidForPrettyPrintingVisitor.makeValid(copy);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        assertEquals(scrambledLines, makePrint(prefs, copy));
View Full Code Here

                "";

        Tuple<SimpleNode, Throwable> objects = PyParser.reparseDocument(new PyParser.ParserInfo(new Document(str),
                IPythonNature.GRAMMAR_PYTHON_VERSION_2_4));
        SimpleNode root = objects.o1;
        root.accept(visitor);
        Iterator<ASTEntry> iterator = visitor.getIterator();
        check((ASTEntry) iterator.next(), "C", 1, 1, 2);
        check((ASTEntry) iterator.next(), "met1", 5, 2, 2);
        check((ASTEntry) iterator.next(), "D", 1, 7, 8);
        check((ASTEntry) iterator.next(), "E", 1, 9, 12);
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.