Author Topic: How to custom color $variables ?  (Read 2845 times)

Offline tonycstech

  • Single posting newcomer
  • *
  • Posts: 7
How to custom color $variables ?
« 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.
« Last Edit: February 09, 2018, 10:10:12 am by tonycstech »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to custom color variables ?
« Reply #1 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.
(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!]

Offline tonycstech

  • Single posting newcomer
  • *
  • Posts: 7
Re: How to custom color $variables ?
« Reply #2 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 !
« Last Edit: February 09, 2018, 10:21:17 am by tonycstech »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to custom color $variables ?
« Reply #3 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.
(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!]