File indexing completed on 2024-04-21 04:34:57

0001 /*
0002     SPDX-FileCopyrightText: 2007 Piyush verma <piyush.verma@gmail.com>
0003     SPDX-FileCopyrightText: 2009 Niko Sams <niko.sams@gmail.com>
0004     SPDX-FileCopyrightText: 2010 Milian Wolff <mail@milianw.de>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef PHP_PARSEJOB_H
0010 #define PHP_PARSEJOB_H
0011 
0012 #include <language/backgroundparser/parsejob.h>
0013 #include <language/duchain/problem.h>
0014 
0015 #include <QStringList>
0016 
0017 #include <ktexteditor/range.h>
0018 
0019 #include <language/duchain/topducontext.h>
0020 
0021 namespace Php
0022 {
0023 
0024 struct AstNode;
0025 class LanguageSupport;
0026 class EditorIntegrator;
0027 
0028 class ParseJob : public KDevelop::ParseJob
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     enum {
0034         Rescheduled = KDevelop::TopDUContext::LastFeature
0035     };
0036 
0037     explicit ParseJob(const KDevelop::IndexedString& url, KDevelop::ILanguageSupport* LanguageSupport);
0038     ~ParseJob() override;
0039 
0040     void setParentJob(ParseJob *job);
0041 
0042 protected:
0043     LanguageSupport* php() const;
0044     void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) override;
0045 
0046 private:
0047     ParseJob *m_parentJob; ///< parent job if this one is an include
0048 
0049     /**
0050      * Checks if a parent job parses already \p document. Used to prevent
0051      * endless recursions in include statements
0052      */
0053     bool hasParentDocument(const KDevelop::IndexedString &document);
0054 
0055     /// create a problem pointer for the current document
0056     KDevelop::ProblemPointer createProblem(const QString &description, AstNode* node,
0057                                            EditorIntegrator * editor, KDevelop::IProblem::Source source,
0058                                            KDevelop::IProblem::Severity severity = KDevelop::IProblem::Error);
0059 };
0060 
0061 }
0062 
0063 #endif
0064 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on; auto-insert-doxygen on