A couple of years ago I wrote a generic syntax highlighting script. What I did was using the syntax files from Edit+ to determine how to parse a given language. All languages have different keywords, function names, delimiters and so on, and to know how to highlight a certain language you need to know these things. The Edit+
.stx files describes all these things.
Since I have gotten a few years more of knowledge, and PHP5 has arrived, I though I should write a new version of it. I could reuse some of the code but alot was rewritten and redesigned totally. The script has two classes:
.stxfile has a newer timestamp than the cached PHP file the PHP file will be regenerated. Alot of this code could be reused from the older version
The new approach has some advantages:
.stxstatements is needed wich speeds thing up alot.
And foremost the code got much much cleaner!
Anyhow! There are a few minor bugs but the code is pretty usable (I have implemented it here in the blogging system). I added the scripts with documentation and a simple example on the server for anyone to download.