Examples of ASTEntry


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

                synchronized (this.lock) {
                    synchronized (ObjectsPool.lock) {
                        key.name = ObjectsPool.internUnsynched(key.name);

                        while (entries.hasNext()) {
                            ASTEntry entry = entries.next();
                            IInfo infoCreated = null;

                            if (entry.parent == null) { //we only want those that are in the global scope
                                if (entry.node instanceof ClassDef) {
                                    //no intern construct (locked in this loop)
View Full Code Here

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

        final FastStringBuffer buf = new FastStringBuffer();
        if (result != null && result.length > 0) {

            for (Object o : result) {
                ASTEntry entry = (ASTEntry) o;
                if (entry.node instanceof ClassDef) {
                    if (buf.length() > 0) {
                        buf.append(',');
                    }
                    buf.append(NodeUtils.getFullRepresentationString(entry.node));
View Full Code Here

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

        Object[] ret = (Object[]) cache.get(element);
        if (ret != null) {
            return ret;
        }

        ASTEntry entry = (ASTEntry) element;

        //Only get classes and 1st level methods for tests.
        if (entry.node instanceof ClassDef) {
            Iterator<ASTEntry> it = visitor.getMethodsIterator();
            ArrayList<ASTEntry> list = new ArrayList<ASTEntry>();
            while (it.hasNext()) {
                ASTEntry next = it.next();
                if (next.parent != null && next.parent.node == entry.node) {
                    list.add(next);
                }
            }
            ASTEntry[] array = list.toArray(new ASTEntry[0]);
View Full Code Here

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

        return null;
    }

    public Object getParent(Object element) {
        ASTEntry entry = (ASTEntry) element;
        return entry.parent;
    }
View Full Code Here

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

        ASTEntry entry = (ASTEntry) element;
        return entry.parent;
    }

    public boolean hasChildren(Object element) {
        ASTEntry entry = (ASTEntry) element;

        if (entry.node instanceof ClassDef) {
            Object[] children = getChildren(entry);
            return children != null && children.length > 0;
        }
View Full Code Here

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

        //Get the top-level classes
        Iterator<ASTEntry> it = visitor.getClassesIterator();
        ArrayList<ASTEntry> list = new ArrayList<ASTEntry>();
        while (it.hasNext()) {
            ASTEntry next = it.next();
            if (next.parent == null) {
                list.add(next);
            }
        }
        return list.toArray(new ASTEntry[0]);
View Full Code Here

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

     */
    public static String getContextName(int lineNumber, SimpleNode ast) {
        if (ast != null) {
            EasyASTIteratorVisitor visitor = EasyASTIteratorVisitor.create(ast);
            Iterator<ASTEntry> classesAndMethodsIterator = visitor.getClassesAndMethodsIterator();
            ASTEntry last = null;
            while (classesAndMethodsIterator.hasNext()) {
                ASTEntry entry = classesAndMethodsIterator.next();
                if (entry.node.beginLine > lineNumber + 1) {
                    //ok, now, let's find out which context actually contains it...
                    break;
                }
                last = entry;
View Full Code Here

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

     */
    public static boolean isValidContextForSetNext(SimpleNode ast, int sourceLine, int targetLine) {
        String sourceFunctionName = NodeUtils.getContextName((sourceLine - 1), ast);
        String targetFunctionName = NodeUtils.getContextName(targetLine, ast);
        if (compareMethodName(sourceFunctionName, targetFunctionName)) {
            ASTEntry sourceAST = NodeUtils.getLoopContextName(sourceLine, ast);
            ASTEntry targetAST = NodeUtils.getLoopContextName(targetLine + 1, ast);

            if (targetAST == null) {
                return true; // Target line is not inside some loop
            }
            if (isValidElseBlock(sourceAST, targetAST, sourceLine, targetLine)) {
                return true; // Debug pointer can be set inside else block of
                             // for..else/while..else
            }
            if (sourceAST == null && targetAST != null) {
                return false; // Source is outside loop and target is inside
                              // loop
            }
            if (sourceAST != null && targetAST != null) {
                // Both Source and Target is inside some loop
                if (sourceAST.equals(targetAST)) {
                    return isValidInterLoopContext(sourceLine, targetLine, sourceAST, targetAST);
                } else {
                    ASTEntry last = sourceAST;
                    boolean retVal = false;
                    while (last != null) {
                        ASTEntry parentAST = last.parent;
                        if (parentAST != null && parentAST.equals(targetAST)) {
                            retVal = true;
                            break;
                        }
                        last = parentAST;
                    }
View Full Code Here

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

     *            the line we want to get the loop context (starts at 1)
     * @param ast
     * @return
     */
    public static ASTEntry getLoopContextName(int lineNumber, SimpleNode ast) {
        ASTEntry loopContext = null;
        if (ast != null) {
            int highestBeginLine = 0;
            ArrayList<ASTEntry> contextBlockList = new ArrayList<ASTEntry>();
            EasyASTIteratorWithLoop visitor = EasyASTIteratorWithLoop.create(ast);
            Iterator<ASTEntry> blockIterator = visitor.getIterators();
            while (blockIterator.hasNext()) {
                ASTEntry entry = blockIterator.next();
                if ((entry.node.beginLine) < lineNumber && entry.endLine >= lineNumber) {
                    contextBlockList.add(entry);
                    if (entry.node.beginLine > highestBeginLine) {
                        highestBeginLine = entry.node.beginLine;
                    }
                }
            }
            Iterator<ASTEntry> contextBlockListIterator = contextBlockList.iterator();
            while (contextBlockListIterator.hasNext()) {
                ASTEntry astEntry = contextBlockListIterator.next();
                if (astEntry.node.beginLine == highestBeginLine) {
                    loopContext = astEntry;
                }
            }
        }
View Full Code Here

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

            DocIterator it = new PySelection.DocIterator(true, new PySelection(doc, 0));
            while (it.hasNext()) {
                String string = it.next();
                if (string.trim().startsWith("#")) {
                    int l = it.getCurrentLine() - 1;
                    addFoldingEntry(ret, new FoldingEntry(FoldingEntry.TYPE_COMMENT, l, l + 1, new ASTEntry(null,
                            new commentType(string))));
                }
            }
        }
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.