This is a project of interest to me too, although I've not seen any such colorizers that were either complete (as Jacob Rus points out, that depends on application dictionaries), nor have I seen any that were really successful. I suspect there's a lot of work to be done there and I'm only starting to look at it.
Colorization is based on parsing the script into these categories:
New Text (editors show uncompiled text in a different color from those below) (so this is not an important category for colorization of working scripts)
After compilation, these categories apply: Operators (+, &, > etc.) Language Keywords (e.g. selection, file , current date, etc. defined in the AppleScript resource) Application Keywords (e.g. Calendar in iCal, defined in the application dictionary) Comments (blocks defined by -- ... return, or (* ... *) Values (numbers, strings, etc.) Variable and Handler names (defined terms not belonging to the list above) References (not sure about this category)
A colorizer must assign a unique color to each, and it must be able to recognize that certain keywords are not single words, but groups of words - do shell script " text ", as alias list, etc.
One of the best I have seen (but don't have code for) was written by John Nathan (often seen as Jonn8).
Adam
At 10:43 PM -0500 11/19/06, Jacob Rus wrote:
Yvon Thoraval wrote:
do you know of a lexer for AppleScript and pygments and/or any other (x)htmlizer (ruby prefered ?)
You can't really handle AppleScript without a full AppleScript compiler. TM's AppleScript language grammar tries to do the best it can, but there are several places where it's impossible to color things correctly without basing parsing on application script dictionaries used by the script.
I think there are some tools that can get that info from Script Editor, for putting correctly highlighted scripts on the web. Not sure where to find them though. Maybe try some of the scripting sites?
-Jacob
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate