File indexing completed on 2024-05-19 15:42:36

0001 /*
0002     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0003     SPDX-FileCopyrightText: 2007 Piyush verma <piyush.verma@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef PYTHON_PARSESESSION_H
0009 #define PYTHON_PARSESESSION_H
0010 
0011 #include <QString>
0012 
0013 #include "parserexport.h"
0014 #include <language/duchain/duchainpointer.h>
0015 #include <language/duchain/problem.h>
0016 #include <language/editor/documentrange.h>
0017 
0018 #include <language/interfaces/iastcontainer.h>
0019 #include <language/editor/rangeinrevision.h>
0020 #include <language/editor/modificationrevision.h>
0021 
0022 #include "ast.h"
0023 #include "astdefaultvisitor.h"
0024 
0025 using namespace KDevelop;
0026 
0027 typedef QPair<KDevelop::DUContextPointer, KDevelop::RangeInRevision> SimpleUse;
0028 
0029 namespace Python
0030 {
0031 class CodeAst;
0032 class Ast;
0033 
0034 class KDEVPYTHONPARSER_EXPORT ParseSession : public IAstContainer
0035 {
0036 public:
0037     ParseSession();
0038     ~ParseSession() override;
0039 
0040     void setContents( const QString& contents );
0041     QString contents() const;
0042     
0043     void setCurrentDocument(const IndexedString& url);
0044     IndexedString currentDocument();
0045 
0046     QPair<CodeAst::Ptr, bool> parse();
0047     
0048     QList<KDevelop::ProblemPointer> m_problems;
0049     
0050     const ModificationRevision& futureModificationRevision() const;
0051     void setFutureModificationRevision(const ModificationRevision& revision);
0052     
0053     CodeAst::Ptr ast;
0054     
0055 private:
0056     QString m_contents;
0057     KDevelop::IndexedString m_currentDocument;
0058     ModificationRevision m_futureModificationRevision;
0059 
0060 };
0061 
0062 }
0063 
0064 #endif
0065 
0066 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on; auto-insert-doxygen on