[QScintilla] Trying to set different color for different set of keywords in QsciLexerCPP
Jonas O.
ezjonas at gmail.com
Fri Nov 12 21:42:36 GMT 2010
In LexCPP.cpp I added:
In colourisecppdoc():
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
WordList &keywords9 = *keywordlists[8];
WordList &keywords10 = *keywordlists[9];
Then in the switch:
else
if (keywords4.InList(s))
{
sc.ChangeState(SCE_C_GLOBALCLASS);
}
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// added from here
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
else
if (keywords5.InList(s))
{
sc.ChangeState(SCE_C_BASETYPE);
}
else
if (keywords6.InList(s))
{
sc.ChangeState(SCE_C_INSTRUCTION);
}
else
if (keywords7.InList(s))
{
sc.ChangeState(SCE_C_MODIFIER);
}
else
if (keywords8.InList(s))
{
sc.ChangeState(SCE_C_CLASSRELATED);
}
else
if (keywords9.InList(s))
{
sc.ChangeState(SCE_C_MISC);
}
else
if (keywords10.InList(s))
{
sc.ChangeState(SCE_C_OPERTEXT);
}
// add end
sc.SetState(SCE_C_DEFAULT);
I also added all SCE_C_* in SciLexer.h, from 20 to 25.
Now it just crashes, segfault apparently.
On Tue, Nov 9, 2010 at 12:45, Jonas O. <ezjonas at gmail.com> wrote:
> Yes I already looked, but there are a lot of if/else in a long switch,
> and that's hard to read (or at least to me), I'm not used to inlined
> curly brackets... (like "if(true) {" or "} else if {")
>
> I'll try to tweak the code and recompile, but I feel like I'm gonna
> break everything...
>
> On Mon, Nov 8, 2010 at 23:32, Phil Thompson <phil at riverbankcomputing.com> wrote:
>> On Mon, 8 Nov 2010 23:24:16 +0100, "Jonas O." <ezjonas at gmail.com> wrote:
>>> Any clue to what I should modify (I don't intend to keep to myself
>>> anyway...) ?
>>
>> Have you actually looked? It's easy enough to follow how the lexer uses
>> keywords - search for "keywords" in LexCPP.cpp.
>>
>> Phil
>>
>
More information about the QScintilla
mailing list