multilanguage kdevelop
Milian Wolff
mail at milianw.de
Thu Jul 29 12:40:45 UTC 2010
On Thursday, 29. July 2010 01:09:09 David Nolden wrote:
> >From what I see, the context doesn't have any members. You could add
>
> an "IndexedString language()" member, and then put that thing into
> kdevplatform as "LanguageTopDUContext" or something like that (after
> all it's the top-context of the language).
>
> Regarding updating: The "setEncountered" thing doesn't look nice.
> Couldn't you just share the same "encountered" cache across all
> context-builders? You could create a class like
>
> namespace KDevelop {
> struct ParseSession {
> bool m_valid;
> SimpleRange m_range;
> QSet<DUChainBase*> m_encountered; // or whatever other
> data-structure we use currently
> ParseJob::Contents m_contents;
> DUContext* m_updating;
> // Add here whatever else would be needed across different languages
> };
> };
>
> And then, you could do something like this:
>
> // We encounter a something that contains a different language than
> what we're parsing now
>
> void parseSubLanguageContext(AST* subLanguageAST)
> {
> ParseSession subSession;
> subSession.m_valid = true;
> subSession.m_range = rangeFromAST(subLanguageAST);
> subSession.m_contents = m_contents;
> subSession.m_encountered = m_encountered;
> subSession.m_updating = createContext(subLanguageAST);
>
> ILanguageSupport* langSupport = languageFromAST(subLanguageAST);
>
> if(langSupport)
> {
> ParseJob* job = langSupport->createParseJob(subSession);
> job->parseForeground();
> m_encountered = subSession.m_encountered;
> }
> }
This does not work as I have reported before. The parsing is done in the
background but the language might not be loaded at that point, and loading a
LangPlugin from the background is explicitly forbidden.
That is why I jumped through hoops with the background parser.
Still, your code above looks much nicer than what I have so if you have any
idea on how to circumvent this hurdle I'm all for it.
I'll still try to use your idea with ParseSession to get the DUChainBase stuff
in. But the problem there would be (with the current approach using the
BackgroundParser) that the DUChainBase* items might get invalidated, right?
I'd have to use some Refcounted pointer like the DeclarationPointer, right?
Hmm...
--
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100729/0fc306fd/attachment.sig>
More information about the KDevelop-devel
mailing list