Examples of ASTEntry


Examples of org.python.pydev.parser.visitors.scope.ASTEntry

                .create(parseLegalDocStr("print a.b.c().d.__class__"));

        Iterator<ASTEntry> iterator = visitor.getIterator();
        iterator.next(); //Module
        iterator.next(); //Print
        ASTEntry entry = iterator.next(); //Attribute
        assertEquals("a.b.c", NodeUtils.getFullRepresentationString(entry.node));

        visitor = SequencialASTIteratorVisitor.create(parseLegalDocStr("'r.a.s.b'.join('a')"));
        iterator = visitor.getIterator();
        iterator.next(); //Module
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

            //uncomment line below to see the time for parsing
            //System.out.println(StringUtils.format("Took: %s secs", (System.currentTimeMillis()-curr)/1000.0));
            SequencialASTIteratorVisitor visitor = SequencialASTIteratorVisitor.create(node);

            ASTEntry entry = visitor.getAsList(Str.class).get(0);
            String s0 = ((Str) entry.node).s;
            assertEquals(42, entry.node.beginLine);
            assertEquals(8, entry.node.beginColumn);
            assertTrue("Expecting big string. Received" + s0, s0.length() > 100);
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

            throw new RuntimeException(e);
        }
        if (definitions != null && definitions.length > 0) {
            init((Definition) definitions[0]);
        } else {
            singleEntry = new ASTEntry(null);
            singleEntry.node = definition.ast;
        }
    }
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

            if (entry.parent != null && entry.parent.node instanceof FunctionDef && entry.node instanceof NameTok
                    && ((NameTok) entry.node).ctx == NameTok.FunctionName) {
                //process a function definition (get the parameters with the given name and
                //references inside that function)
                processFunctionDef(ret, entry);
                ASTEntry parent = entry.parent;
                acceptedCommentRanges.add(new Tuple<Integer, Integer>(parent.node.beginLine, parent.endLine));

            } else if (entry.node instanceof Name) {
                processFoundName(root, ret, (Name) entry.node);
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

        //Step 1: create 'regular' tree structure from the nodes.
        TreeNode<OutlineEntry> root = new TreeNode<OutlineEntry>(null, null, null);

        for (Iterator<ASTEntry> it = visitor.getOutline(); it.hasNext();) {
            ASTEntry next = it.next();
            TreeNode<OutlineEntry> n;
            if (next.parent != null) {
                TreeNode<OutlineEntry> parent = entryToTreeNode.get(next.parent);
                if (parent == null) {
                    Log.log("Unexpected condition: child found before parent!");
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

                continue;
            }

            Iterator<ASTEntry> outline = visitor.getOutline();
            while (outline.hasNext()) {
                ASTEntry entry = outline.next();
                if (entry.parent == null) {
                    //only direct children...
                    new TreeNode<OutlineEntry>(nextEntry, new OutlineEntry(entry, parent), null);
                }
            }
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

    }

    private void compare(List<ASTEntry> initial, ArrayList<ASTEntry> expected) {
        StringBuffer buf1 = new StringBuffer();
        for (int i = 0; i < initial.size(); i++) {
            ASTEntry o1 = initial.get(i);
            buf1.append(o1.getAdditionalInfo(AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_LOCATION, 0));
        }

        StringBuffer buf2 = new StringBuffer();
        for (int i = 0; i < expected.size(); i++) {
            ASTEntry o1 = expected.get(i);
            buf2.append(o1.getAdditionalInfo(AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_LOCATION, 0));
        }

        assertEquals(buf1.toString(), buf2.toString());
    }
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

        assertEquals(buf1.toString(), buf2.toString());
    }

    private void createString(List<ASTEntry> initial) {
        ASTEntry entry = new ASTEntry(null);
        entry.setAdditionalInfo(AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_LOCATION,
                AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_IN_STRING);
        add(entry, initial);
    }
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

                AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_IN_STRING);
        add(entry, initial);
    }

    private void createComment(List<ASTEntry> initial) {
        ASTEntry entry = new ASTEntry(null);
        entry.setAdditionalInfo(AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_LOCATION,
                AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_IN_COMMENT);
        add(entry, initial);
    }
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

                AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_IN_COMMENT);
        add(entry, initial);
    }

    private void createRegular(List<ASTEntry> initial) {
        add(new ASTEntry(null), initial);
    }
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.