Tom Copeland's Recent Posts

RSS Feeds

« svn+http on RubyForge | Main | Rails + Facebook, good times »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451d3c069e200e55070ac288834

Listed below are links to weblogs that reference JavaCC example code posted:

Comments

The Java HTMLizer looks good. I've used various tools to do this sort of work before, including vi and PHP.

What I've often thought would be useful, is for it to first try to colorize using the lexer, and then attempt to colorize using a parser. The reason is, if you have a code fragment, the lexer approach works well, and the parser would fail. However, the lexer can't mark instance variables in a different color. If your used to using an IDE, you expect local variables to look different than instance or class variables.

Brian - right on, without the parser you can't discern syntax-level differences; but using just the tokenizer would work fine for fragments. Actually, I wonder if you could try various grammar start symbols - MethodDeclaration(), Statement(), etc - with a code fragment to try to get the benefits of running it through the parser as well.

One thing that's been mentioned on javacc-users is doing "incremental" syntax highlighting with a JavaCC grammar. I'd like to try that... it seems doable, just need to figure out how to hook things together in a nice way.

The comments to this entry are closed.