User forums > Using Code::Blocks

How to custom color $variables ?

(1/1)

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 ?

--- End quote ---
Inspect and modify the code of the cpp lexer in the scintilla component.

tonycstech:
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

--- Code: --- <Style name="Variables starting with $ (TEST)"
                        index="114"
                        fg="133,133,172"
                        bold="1"/>
--- End code ---
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.

Navigation

[0] Message Index

Go to full version