News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

How to custom color $variables ?

Started by tonycstech, February 09, 2018, 07:05:42 AM

Previous topic - Next topic

tonycstech

I know it is not recommended  to code C++ using symbols to create variables such as $variable as it is done in PHP and other languages such as AUTOIT because "it does not look professional".
But i can give very little to none goat bum what so ever about my codes not looking professionaly or not.
World knows, C++ is very difficult to read by looking at the code. Mainly because everything looks the same.

My question is: Besides the syntax highlight (that does not see to have the option i am looking for) is there any way i can highlight every word/number with a specific color if that word/number has $ symbol in front of it ? For instance, i want all $var and $1234 and such, be all read.

Any help please ?
Thank you.

oBFusCATed

Quote from: tonycstech on February 09, 2018, 07:05:42 AM
Any way to accomplish this ?
Inspect and modify the code of the cpp lexer in the scintilla component.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

tonycstech

#2
Thank you but I have no idea what you are talking about.  ???
Any more insight on that ?

I am new to C++ and code blocks.
Please give me some coordinates to work with as well as the address i am looking for.

I found lexer_cpp.xml and created new style
<Style name="Variables starting with $ (TEST)"
                        index="114"
                        fg="133,133,172"
                        bold="1"/>

But i dont know how to set that to red, nor do i know if it will respond to words that have $ in front of them. I highly doubt that.
Thanks !

oBFusCATed

Here http://www.scintilla.org/Lexer.txt

But if you're new to C++ you should reconsider the feasibility of using $ or other strange symbols in identifiers.
Also, you should reconsider reusing names that match names in standard library.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]