Syntax is a pure-Ruby framework for doing lexical analysis (and, in 
particular, syntax highlighting) of text. It currently sports lexers 
for Ruby, XML, and YAML, and an HTML convertor (for colorizing texts in 
those languages to HTML).

Links:

   Download: http://rubyforge.org/frs/?group_id=505
   User Manual: http://docs.jamisbuck.org/read/book/4

This release is much improved in accuracy and robustness (at least, for 
the Ruby lexer--the XML and YAML lexers were not changed). The Ruby 
lexer now deals better with many ambiguous cases, and even supports 
multiple heredocs on a single line. It accurately colorizes cgi.rb and 
mkmf.rb from the standard lib, if that means anything at all to you.

The Syntax framework also supports "regions" now (thanks to flgr for 
the suggestion) and sports many bug fixes (thanks to Carl Drinkwater 
for discovering most of them). Syntax regions just allow one group to 
span (and include) multiple groups--like a string that includes 
interpolated expressions and escape sequences.

For a pretty example (mkmf.rb fully syntax highlighted) see 
http://ruby.jamisbuck.org/mkmf.html.

The next release will include robustness fixes for the XML and YAML 
lexers, as well as a lexer for C. Lexers for Perl, Python, Java, HTML, 
and RHTML would be nice as well, if I can get to them. Community 
submissions will be gladly accepted, as long as you are okay with your 
contributed code being distributed under the BSD license.

Enjoy!

- Jamis