PHP Syntax Highligting

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Jesus_H_Christ
Posts: 3
Joined: Tue Jan 20, 2004 5:50 pm
Location: Stratford, CT
Contact:

PHP Syntax Highligting

Post by Jesus_H_Christ »

As languages get goofier syntax highlighting needs to be improved.

The syntax highlighting support in TextPad is a bit clownin' and there is one major thing, and a minor thing that has gotz to be changed.

[major] Support for Heredoc strings (<<<EOT)
http://www.php.net/manual/en/language.t ... ax.heredoc

When I use Heredoc strings in my PHP scripts it will totally face up the syntax highlighting. I tried to set <<<EOT and EOT; in the syntax file instead of " but it didn't work.

[minor] Support for funny strings: print "PHP Action {$_GET['junk']}";

It would be nice if Textpad could highlight that expression properly.
Justin R. Tunney
User avatar
ramonsky
Posts: 88
Joined: Fri Nov 14, 2003 10:54 am

Post by ramonsky »

Actually, this is a very good point. In PHP (and also in many Unix shells) a string such as "x = $x" isn't actutually a constant! Why not? Because the $x inside the quote marks is expanded at the point of execution, and not before. So, if you were to highlight it to reflect actual usage it would be something like:

" x = $x"

The somewhat more complex examples of Jesus H Christ (nice name by the way 8) ) would require even more complex coloring, but the trick really is to know exactly what is "escaped" and what isn't when inside quotes.

It's interesting to consider that I actually modify the way that I write PHP in order to get the colors right! That is, I would tend, instead of writing:

Code: Select all

print "PHP Action {$_GET['junk']}"; 
to write

Code: Select all

echo "PHP Action ", $_GET['junk'];
because that way it gets the colors right. Hmmm....
Post Reply