6V8 - Production of my Mind

Home page > For your Computer > PHP code Beautifier

PHP code Beautifier

 
Here a simple modification to a php code beautifier to support regular expression for finding strings to highlight.
13 May 2004, by Mortimer

Beautifier is a php syntax formatter and highlighter. It’s not really complete, but is easy to use.

However, a simple feature is lacking: the words colored are detected using a simple hash table of keywords. Hence, keywords not registered (like variables name for example) are not highlighted. Therefore I implemented a simple detection of such keywords by using regular expressions.

You can then had in your HFile a table $this->keypats that maps perl style regular expression to category number.

for example: $this->keypats = array(’/\\$[a-z_0-9A-Z]+/’ => "3", ’/[0-9]+/’ => "4");

The new sources are attached, under GPL. Please provide a link to the sources on your site if you use this tool.

Date of online publication: 13 May 2004
last-update: 10 July 2004
All the versions of this article:
Forum messages 0
visits:
11006

Creative Commons Attribution NonCommercial ShareAlike 2.5  License
 
 

The most read articles

 
©
Pierre Andrews
York, uk
| Site Map | Site created with SPIP 1.9.2c [10268] | RSS | template by IZO, Mortimer. | clicky stats
published Tina of other tiramisu
published Tina of other tiramisu
published Tina of other tiramisu
published Tina of other tiramisu
published Tina of other tiramisu