.cpp keywords - color question

Discuss syntax highlighting or submit new syntax files.
Post Reply
DerellLicht1
Posts: 38
Joined: 23 Jul 2021 17:38

.cpp keywords - color question

Post by DerellLicht1 »

I notice that in the syntax-highlighting-customize screen, 'All Languages' shows multiple entries for colors;
keyword1, keyword2, etc...

However, if I change highlighter-language to C++, then there is only *one* field for keyword...
I would actually *love* to have multiple keyword lists, with different colors (same with the .rc files)...
What is the trick to doing this??

User avatar
pjj
Posts: 1935
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: .cpp keywords - color question

Post by pjj »

But you have multiple keyword lists! "Keywords", "Data types", "#Preprocessor directives" etc. are all keywords, as this word is employed in RJ TE syntax scheme -- go to "Keywords" tab in the Syntax editor and enjoy Keyword groups -- and then enjoy them even more upon noticing that they may be defined using regex.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

DerellLicht1
Posts: 38
Joined: 23 Jul 2021 17:38

Re: .cpp keywords - color question

Post by DerellLicht1 »

Ahhhh!! I just realized that I can add labels (keywords2, etc) under Keyword groups...
Okay, let's see if that actually works for me, once I set colors for keywords2 ...

Later note:
Well, this works well enough, but I don't quite understand *how* it works...

So for the .rc resource files, I want to use two different syntax colors;
one for the primary keywords (LTEXT, PUSHBUTTON, CONTROL, etc),
and a different one for secondary keywords (WS_POPUP, WS_VISIBLE, WS_CAPTION, etc), which are parameters for the primary keywords...

So, under the .rc syntax file, I created a keywords2 group, and added the secondary keywords to that...
However, the editor actually applies the color for 'keyword7', not for 'keyword2' !!!

So what is going on here?? I mean, it *does* accomplish the purpose that I wanted, but it doesn't make sense... how does this work?? Mind you, I am still setting colors under "All languages", not specifically for this extension... Maybe that is what is wrong??

User avatar
pjj
Posts: 1935
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: .cpp keywords - color question

Post by pjj »

DerellLicht1 wrote:
28 Jul 2021 16:29
Mind you, I am still setting colors under "All languages", not specifically for this extension... Maybe that is what is wrong??
Yeah, I think that's it. You have "keyword1", "keyword2" for all languages, and specific keyword groups names that seem to work for specific highlighters, so my suggestion would be to set these colors for RS one.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

Post Reply