Examples of ASTEntry


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

    protected void onAfterStartScope(int newScopeType, SimpleNode node) {
        if (parents == null) {
            parents = new FastStack<ASTEntry>(10);
        }
        if (parents.size() == 0) {
            parents.push(new ASTEntry(null, node));
        } else {
            parents.push(new ASTEntry(parents.peek(), node));
        }
    }
View Full Code Here

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

        }
    }

    @Override
    protected void onAfterEndScope(SimpleNode node, ScopeItems m) {
        ASTEntry parent = popParent(node);
        if (hitAsUndefined == null) {
            for (String rep : new FullRepIterable(this.completeNameToFind, true)) {
                List<Found> foundItems = m.getAll(rep);
                for (Found found : foundItems) {
                    if (checkFound(found, parent) != null) {
View Full Code Here

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

            } else if (nameToFind.equals(representation)) {
                if (ast instanceof Attribute) {
                    //it can happen, as we won't go up to the part of the actual call (if there's one).
                    ast = NodeUtils.getAttributeParts((Attribute) ast).get(0);
                    ASTEntry entry = new ASTEntry(tup.o3, ast);
                    entry.setAdditionalInfo(FOUND_ADDITIONAL_INFO_IN_AST_ENTRY, tup.o4);
                    ret.add(entry);
                } else {
                    ASTEntry entry = new ASTEntry(tup.o3, ast);
                    entry.setAdditionalInfo(FOUND_ADDITIONAL_INFO_IN_AST_ENTRY, tup.o4);
                    ret.add(entry);
                }

            } else if (FullRepIterable.containsPart(representation, nameToFind)) {

                Name nameAst = new Name(nameToFind, Name.Store, false);
                List<String> strings = StringUtils.dotSplit(representation);

                int plus = 0;
                for (String string : strings) {
                    if (string.equals(nameToFind) && (plus + nameToFind.length() >= tup.o2)) {
                        break;
                    }
                    plus += string.length() + 1; //len + dot
                }
                nameAst.beginColumn = AbstractMessage.getStartCol(token, document) + plus;
                nameAst.beginLine = AbstractMessage.getStartLine(token, document);
                Tuple3<String, Integer, Integer> t = new Tuple3<String, Integer, Integer>(nameToFind,
                        nameAst.beginColumn, nameAst.beginLine);
                if (!s.contains(t)) {
                    s.add(t);
                    ASTEntry entry = new ASTEntry(tup.o3, nameAst);
                    entry.setAdditionalInfo(FOUND_ADDITIONAL_INFO_IN_AST_ENTRY, tup.o4);
                    ret.add(entry);
                }
            }
        }
View Full Code Here

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

        AttributeReferencesVisitor visitor = AttributeReferencesVisitor.create(simpleNode, accept);
        Iterator<ASTEntry> iterator = visitor.getNamesIterator();

        while (iterator.hasNext()) {
            ASTEntry entry = iterator.next();
            String rep = NodeUtils.getFullRepresentationString(entry.node);
            if (rep.equals(occurencesFor)) {
                ret.add(entry);
            }
        }
View Full Code Here

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

            @Override
            public Object visitStr(Str node) throws Exception {
                String str = NodeUtils.getStringToPrint(node);
                List<Name> names = checkSimpleNodeForTokenMatch(occurencesFor, new ArrayList<Name>(), node, str);
                for (Name name : names) {
                    ASTEntry astEntryToAdd = atomic(name);
                    astEntryToAdd.setAdditionalInfo(AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_LOCATION,
                            AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_IN_STRING);
                    ret.add(astEntryToAdd);
                }
                return super.visitStr(node);
            }
View Full Code Here

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

            private void checkNode(final String occurencesFor, final List<ASTEntry> ret, SimpleNode node) {
                List<Name> names = checkComments(node.specialsBefore, occurencesFor);
                names.addAll(checkComments(node.specialsAfter, occurencesFor));
                for (Name name : names) {
                    ASTEntry astEntryToAdd = atomic(name);
                    astEntryToAdd.setAdditionalInfo(AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_LOCATION,
                            AstEntryScopeAnalysisConstants.AST_ENTRY_FOUND_IN_COMMENT);
                    ret.add(astEntryToAdd);
                }
            }
View Full Code Here

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

            }
        }

        Iterator<ASTEntry> iterator = visitor.getNamesIterator();
        while (iterator.hasNext()) {
            ASTEntry entry = iterator.next();
            //SimpleNode nameNode = entry.getNameNode();
            //if(!occurencesFor.isParamRename){
            //    if(nameNode instanceof NameTok){
            //        NameTok name = (NameTok) nameNode;
            //        if(name.ctx == NameTok.KeywordName){
            //            continue;
            //        }
            //   }
            //}
            if (occurencesFor.equals(entry.getName())) {
                ret.add(entry);
            }
        }
        return ret;
    }
View Full Code Here

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

        SequencialASTIteratorVisitor visitor = SequencialASTIteratorVisitor.create(simpleNode);
        Iterator<ASTEntry> iterator = visitor.getIterator(Attribute.class);

        while (iterator.hasNext()) {
            ASTEntry entry = iterator.next();
            String rep = NodeUtils.getFullRepresentationString(entry.node, true);
            if (rep.equals(occurencesFor)) {
                ret.add(entry);
            }
        }
View Full Code Here

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

                foundAsComment = true;
                break;
            }
        }

        ASTEntry classDefInAst = null;
        if (!foundAsComment && (request.moduleName == null || request.moduleName.equals(definition.module.getName()))) {
            classDefInAst = getOriginalClassDefInAst(root);

            if (classDefInAst == null) {
                status.addFatalError("Unable to find the original definition for the class definition.");
View Full Code Here

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

     * @return the function definition that matches the original definition as an ASTEntry
     */
    private ASTEntry getOriginalClassDefInAst(SimpleNode simpleNode) {
        SequencialASTIteratorVisitor visitor = SequencialASTIteratorVisitor.create(simpleNode);
        Iterator<ASTEntry> it = visitor.getIterator(ClassDef.class);
        ASTEntry classDefEntry = null;
        while (it.hasNext()) {
            classDefEntry = it.next();

            if (classDefEntry.node.beginLine == this.definition.ast.beginLine
                    && classDefEntry.node.beginColumn == this.definition.ast.beginColumn) {
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.