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/services/trackback/6a00d83451d3c069e200e5505cdb048833

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...

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

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