[antlr-interest] Capturing comments

Jim Crafton jim.crafton at gmail.com
Sat May 21 16:17:40 PDT 2005


Is there a good example of a way to capture a block of C/C++ style
comments and store them in a custom AST class? I have a custom AST
class and I'm storing the line/col of all the nodes, but I'd also like
ot store off comments as well. For example, consider the following:

/**
Some comments here...
*/
class Foo {

};

I'd like to capture the "Some comments here..." text and associate it
with the "Foo" node. Is that possible?

Thanks 

Jim


More information about the antlr-interest mailing list