File indexing completed on 2024-03-24 16:05:55

0001 /*
0002     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0003     SPDX-FileCopyrightText: 2007 Piyush verma <piyush.verma@gmail.com>
0004     SPDX-FileCopyrightText: 2010-2012 Sven Brauch <svenbrauch@googlemail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef PYTHON_PARSEJOB_H
0010 #define PYTHON_PARSEJOB_H
0011 
0012 #include "ast.h"
0013 
0014 #include <QStringList>
0015 
0016 #include <QExplicitlySharedDataPointer>
0017 #include <ktexteditor/range.h>
0018 #include <astdefaultvisitor.h>
0019 
0020 #include <language/backgroundparser/parsejob.h>
0021 #include <language/duchain/duchainpointer.h>
0022 #include <language/duchain/topducontext.h>
0023 
0024 using namespace KDevelop;
0025 
0026 namespace Python
0027 {
0028 
0029 class ParseSession;
0030 class LanguageSupport;
0031 
0032 class ParseJob : public KDevelop::ParseJob
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     enum {
0038         Rescheduled = (KDevelop::TopDUContext::LastFeature << 1),
0039         PEP8Checking = (KDevelop::TopDUContext::LastFeature << 2)
0040     };
0041     ParseJob(const IndexedString& url, ILanguageSupport* languageSupport );
0042     ~ParseJob() override;
0043 
0044     virtual CodeAst* ast() const;
0045     bool wasReadFromDisk() const;
0046     void eventuallyDoPEP8Checking(TopDUContext* topContext);
0047 
0048     ControlFlowGraph* controlFlowGraph() override;
0049     DataAccessRepository* dataAccessInformation() override;
0050 
0051 protected:
0052     void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread* thread) override;
0053 
0054 private:
0055     QVector<QUrl> m_cachedCustomIncludes;
0056     CodeAst::Ptr m_ast;
0057     bool m_readFromDisk;
0058     KDevelop::ReferencedTopDUContext m_duContext;
0059     KTextEditor::Range m_textRangeToParse;
0060     QExplicitlySharedDataPointer<ParseSession> m_currentSession;
0061 };
0062 
0063 }
0064 
0065 #endif
0066 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on; auto-insert-doxygen on