Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: tonycstech on February 09, 2018, 07:05:42 am

Title: How to custom color $variables ?
Post by: tonycstech on February 09, 2018, 07:05:42 am
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.
Title: Re: How to custom color variables ?
Post by: oBFusCATed on February 09, 2018, 09:38:10 am
Any way to accomplish this ?
Inspect and modify the code of the cpp lexer in the scintilla component.
Title: Re: How to custom color $variables ?
Post by: tonycstech on February 09, 2018, 10:12:02 am
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"/>
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 !
Title: Re: How to custom color $variables ?
Post by: oBFusCATed on February 09, 2018, 03:16:10 pm
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.