Making a small change to the PHP wordfile.

Syntax highlighting, code folding, brace matching, code indenting, and function list

Making a small change to the PHP wordfile.

Postby rhapdog » Sat Mar 03, 2012 9:17 pm

I have been long disgusted with the fact that I have been unable to properly "highlight" special types of variables in PHP. Specifically, $this->foobar.

So, taking a look at the syntax highlighting word file, I decided to experiment a little bit. I tried numerous things to no avail, until I finally made just one, small, minor adjustment.

In section /C3 I did the following:
Code: Select all
/C3"Variables" STYLE_VARIABLE
** $ & ->

All I did there was add the "->" after the "&". I didn't do a sort, so I'm not sure if it was in the right location, but it worked.

Now, $this still highlights as a keyword. But the ->foobar afterward will highlight as a variable. Also, $foo->bar will highlight entirely as a variable. Then again, $foo->bar() will also highlight as a variable, minus the parentheses. Now, if there were some way to get $foo->bar() to highlight as a function... (There may be, but I haven't had time to work on that one yet.)
User avatar
rhapdog
Master
Master
 
Posts: 271
Joined: Tue Apr 01, 2008 10:02 am
Location: Mississippi, USA

Return to Syntax Highlighting