Package org.python.pydev.editor.codecompletion.revisited.modules

Examples of org.python.pydev.editor.codecompletion.revisited.modules.SourceToken


    @SuppressWarnings("unchecked")
    /*default*/void checkAttrFound(Call callNode, TokenFoundStructure found) throws Exception,
            CompletionRecursionException {
        FunctionDef functionDefinitionReferenced;
        SourceToken nameToken;
        boolean callingBoundMethod;
        if (found != null && found.defined && found.token instanceof SourceToken) {
            nameToken = (SourceToken) found.token;
            String rep = nameToken.getRepresentation();

            ArrayList<IDefinition> definition = new ArrayList<IDefinition>();
            SimpleNode ast = nameToken.getAst();
            try {
                PyRefactoringFindDefinition.findActualDefinition(null, this.current, rep, definition, ast.beginLine,
                        ast.beginColumn, this.nature, this.completionCache);
            } catch (Exception e) {
                Log.log(e);
View Full Code Here


                                }
                            }
                        }

                    }
                    SourceToken token = AbstractVisitor.makeToken(node, "");
                    messagesManager.addMessage(IAnalysisPreferences.TYPE_DUPLICATED_SIGNATURE, token, name);
                }
            }
        }
    }
View Full Code Here

    @Override
    public Object visitCompare(Compare node) throws Exception {
        Object ret = super.visitCompare(node);
        if (isInTestScope == 0) {
            SourceToken token = AbstractVisitor.makeToken(node, moduleName);
            messagesManager.addMessage(IAnalysisPreferences.TYPE_NO_EFFECT_STMT, token);
        }
        return ret;
    }
View Full Code Here

                visitName(name);

                //Check if the name was actually found in some way...
                TokenFoundStructure found = popFound();
                if (found != null && found.token instanceof SourceToken) {
                    final SourceToken sourceToken = (SourceToken) found.token;
                    if (found.defined) {
                        argumentsChecker.checkNameFound(callNode, sourceToken);
                    } else if (found.found != null) {
                        //Still not found: register a callback to be called if it's found later on.
                        found.found.registerCallOnDefined(new ICallbackListener<Found>() {

                            public Object call(Found f) {
                                try {
                                    List<GenAndTok> all = f.getAll();
                                    for (GenAndTok genAndTok : all) {
                                        if (genAndTok.tok instanceof SourceToken) {
                                            SourceToken sourceToken2 = (SourceToken) genAndTok.tok;
                                            if (sourceToken2.getAst() instanceof FunctionDef
                                                    || sourceToken2.getAst() instanceof ClassDef) {
                                                argumentsChecker.checkNameFound(callNode, sourceToken2);
                                                return null;
                                            }
                                        }
                                    }
View Full Code Here

                if (foundAs.importInfo != null) {
                    IDefinition[] definition = foundAs.importInfo.getDefinitions(nature, completionCache);
                    for (IDefinition iDefinition : definition) {
                        Definition d = (Definition) iDefinition;
                        if (d.ast instanceof FunctionDef || d.ast instanceof ClassDef) {
                            SourceToken tok = AbstractVisitor.makeToken(d.ast, token.getRepresentation(),
                                    d.module != null ? d.module.getName() : "");
                            tok.setDefinition(d);
                            onPushToRecordedFounds(tok);
                            reportFound = false;
                            break;
                        }
                    }
View Full Code Here

    @Override
    protected void onFoundInNamesToIgnore(IToken token, IToken tokenInNamesToIgnore) {
        if (analyzeArgumentsMismatch) {
            if (tokenInNamesToIgnore instanceof SourceToken) {
                SourceToken sourceToken = (SourceToken) tokenInNamesToIgnore;
                //Make a new token because we want the ast to be the FunctionDef or ClassDef, not the name which is the reference.
                onPushToRecordedFounds(AbstractVisitor.makeToken(sourceToken.getAst(), token.getRepresentation(),
                        sourceToken.getParentPackage()));
            }
        }
    }
View Full Code Here

    private void creteMessagesForStack(FastStack<HashMap<String, Tuple<Expected, FunctionDef>>> stack) {
        HashMap<String, Tuple<Expected, FunctionDef>> noDefinedItems = stack.pop();
        for (Map.Entry<String, Tuple<Expected, FunctionDef>> entry : noDefinedItems.entrySet()) {
            Expected expected = entry.getValue().o1;
            if (!expected.expected.equals(expected.received)) {
                SourceToken token = AbstractVisitor.makeToken(entry.getValue().o2, moduleName);
                messagesManager.addMessage(IAnalysisPreferences.TYPE_NO_SELF, token,
                        new Object[] { token, entry.getValue().o1.expected });
            }
        }
    }
View Full Code Here

        if (!generator.isImport()) {
            return generator.getLineDefinition();
        }

        //ok, it is an import... (can only be a source token)
        SourceToken s = (SourceToken) generator;

        SimpleNode ast = s.getAst();
        if (ast instanceof ImportFrom) {
            ImportFrom i = (ImportFrom) ast;
            //if it is a wild import, it starts on the module name
            if (AbstractVisitor.isWildImport(i)) {
                return i.module.beginLine;
View Full Code Here

        if (!generator.isImport()) {
            return generator.getColDefinition();
        }

        //ok, it is an import... (can only be a source token)
        SourceToken s = (SourceToken) generator;

        SimpleNode ast = s.getAst();
        if (ast instanceof ImportFrom) {
            ImportFrom i = (ImportFrom) ast;
            //if it is a wild import, it starts on the module name
            if (AbstractVisitor.isWildImport(i)) {
                return i.module.beginColumn;
View Full Code Here

     */
    public static int getEndCol(IToken generator, IDocument doc, String shortMessage, boolean getOnlyToFirstDot) {
        int endCol = -1;
        if (generator.isImport()) {
            //ok, it is an import... (can only be a source token)
            SourceToken s = (SourceToken) generator;

            SimpleNode ast = s.getAst();

            if (ast instanceof ImportFrom) {
                ImportFrom i = (ImportFrom) ast;
                //ok, now, this depends on the name
                NameTok it = getNameForRepresentation(i, shortMessage, true);
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.codecompletion.revisited.modules.SourceToken

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.