Now in stock!

Tom Copeland's Recent Posts

RSS Feeds

« Better JJTree Visitors | Main | RubyForge on Rails »

JavaCC/JJTree file generation bug fix

For a long time there's been an annoying bug with JJTree and Windows.   JJTree generates source files with the directory path in a comment header, and if one of the subdirectoy names starts with a "u" it ends up being output as a Unicode escape.  This causes problems about ten seconds down the road when you try to compile the code.

For example, suppose you're generating the JJTree files into my\utils\dir.  You'll get a comment header like this in your Constants file:

/* Generated By:JJTree: Do not edit this line.  my\utils\dir\SomeParserTreeConstants.java */

A \u begins a Java Unicode escape sequence, and \utils is, of course, an invalid escape sequence.  Thus the compiler chokes on this invalid sequence when it tries to lex this file. 

Well, thanks to Paul Cager, this bug is fixed in CVS.  He actually just avoided the problem by just printing the generated file name in the comment header rather than including the whole directory path.  I've uploaded an updated JavaCC 4.0 jar file here if you want to give it a try.   Enjoy, and thanks to Paul for cleaning this up!

Using JavaCC?  Check out my JavaCC book!

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/512521/23058560

Listed below are links to weblogs that reference JavaCC/JJTree file generation bug fix:

Comments

Tom, something I'd love to see make it's way into rubyforge: A clear and findable display for gem dependancies. I spend a lot of time stuck working behind the firewall, and have to download and transfer gems on a disk. It's a real pain to discover after downloading and transfering the file that there are unfulfilled dependancies.

Chris - Hm, yeah, that would be nice... that kind of rings a bell somehow. Have you posted about this to ruby-talk? Maybe someone's got something like that in the works...

Post a comment

Comments are moderated, and will not appear on this weblog until the author has approved them.

If you have a TypeKey or TypePad account, please Sign In