From: Lothar Scholz Date: 2002-05-26T10:58:17+09:00 Subject: Ruby Syntax Highlighting (and a Ruby Parser BUG) I'm just trying to write a syntax highlighting plug in for my editor and found this task very very hard. For example look at the following string: print "String #{ ($a={1=>2, 2=> "mystring" , 4=>6}).length }" I think an editor should highlight everything after "print" in the string color. But it is impossible for my colorize algorithm to find out where the string ends without writing a complete ruby expression parser. And i discovered that the ruby interpreter itself does not handle this situation right. If you replace the string "mystring" with the string ")}mystring" so that the line becomes print "String #{ ($a={1=>2, 2=> "})mystring" , 4=>6}).length }" the parser signals a syntax error. This is a RUBY (1.6.7) bug. The more time i spend with this terrible ruby syntax the more i think it should be cleaned up from all this special cases that saves you (in the best case) not more then 4 keystrokes. And finally a question: What do you expect from editor syntax highlighting ? Until now i believed heuristics are evil, because the different colors are there to show you errors immediately. But with this ruby example i'm not sure any more. And i don't think that any of the other ruby tools are working correctly.