R Brush for SyntaxHighlighter

SyntaxHighlighter is a JavaScript library for displaying source code with color syntax highlighting. (You can see that it's appropriately named.)

A module (or "brush" as it's called) for the R language was sadly missing, and was the first thing that I decided to use SyntaxHighlighter for. So I wrote my own which can be downloaded below.

Download R Brush

Version 1.0, 4 December 2009, Initial release.

This is the initial release and I've really only tested it on a single script I had lying around, so any suggestions for improvement would be greatly appreciated.

The source file is commented, so feel free to peruse it for details about implementation.

Features!

R has a very long list of built in functions which take parameters in parentheses. Because of this, there is a much more likely chance that these keywords will collide with variable names. Take the following trivial and entirely reasonable example:

The brush differentiates between the function c() and the variable "c". It also doesn't highlight the "length" parameter in vector() but does highlight the length() function.

Finally, despite the length of whitespace in line 6 (which is valid in R), the highlighting still does the right thing.

License

This software is distributed under the "Attention Seeker" license. If you find this useful, feel free to send me an email to let me know how amazing you think it is. (Yes, it's a real license. It will catch on, trust me.) If you don't find it amazing, then consider this a fine opportunity to brush up on your lying skills.

Also, LGPL.

Contact Information

Please send any questions, comments, or suggestions for improvement to me:

Demitri Muna
Email: xxxdemitrixxx -at- xmex -dot- com
(Remove the 'x's to thwart spam-bots.)