|
List Info
Thread: DUChain How to
|
|
| DUChain How to |

|
2007-07-22 02:36:53 |
|
I am working on implementing a DUchain for Python as a part of my SOC project, and the work so far is available at http://websvn.kde.org/trunk/playground/devtools/kdevelop4-extra-plugins/python/
I have found myself stuck for quite a while now, and here is the recent patch. If you could look in the codes and help me move a few steps further i can get on with the rest of the project easily. The basic trouble that i am facing is with the implementation of the contextbuilder header, as of now. The header is in the name
contextbuilder.h in the repository. The Indentation blocks make up a context for Python, which can have as many child contexts.
Index: pythonlanguagesupport.cpp ===================================================================
--- pythonlanguagesupport.cpp (revision 689529) +++ pythonlanguagesupport.cpp (working copy)
 -66,7 +66,7   void PythonLanguageSupport::documentChanged( KDevelop::IDocument* doc ) { kDebug() << "###########--Adding document to parser--################" << endl;
- language()->backgroundParser()->addDocument(doc->url()); + BackgroundParser::self()->addDocument(doc->url()); } PythonLanguageSupport::~PythonLanguageSupport() { Index:
pythonparsejob.cpp =================================================================== --- pythonparsejob.cpp (revision 689529) +++ pythonparsejob.cpp (working copy)
 -112,6 +112,7  
if ( matched )
{ + new ContextBuilder(m_session); kDebug() << "----Parsing Succeded---"<<endl;//TODO: bind declarations to the code model } else Index: parser/contextbuilder.h
=================================================================== --- parser/contextbuilder.h (revision 689529) +++ parser/contextbuilder.h (working copy)
 -29,6 +29,7  
#include <identifier.h
> #include <ducontext.h> +#include <ksharedptr.h>
namespace KDevelop {
 -38,6 +39,7   class TopDUContext; }
+class PythonEditorIntegrator; class ParseSession;
namespace Python {
 -45,11 +47,14   typedef KSharedPtr<LexedFile> LexedFilePointer; }
+using namespace python; + class ContextBuilder: public python::default_visitor {
public: ContextBuilder(ParseSession* session); + ContextBuilder(PythonEditorIntegrator* editor);
virtual ~ContextBuilder ();
 -68,9 +73,11   return m_encountered.contains(item);
}
- virtual void openContext(KDevelop: UContext* newContext); +// virtual void openContext(KDevelop: UContext* newContext); +// +// virtual void closeContext();
- virtual void closeContext();
+ PythonEditorIntegrator* m_editor;
QSet<KDevelop: UChainBase*> m_encountered; QStack<KDevelop: UContext*> m_contextStack; Index: parser/parsesession.h ===================================================================
--- parser/parsesession.h (revision 689529) +++ parser/parsesession.h (working copy)
 -26,7 +26,10   #include <QtCore/QByteArray>
#include <python_parser.h> +#include <
ksharedptr.h> +#include <ktexteditor/cursor.h>
+class LexedFile; using namespace python;
class ParseSession Index: parser/contextbuilder.cpp ======================================= | |