[antlr-interest] Capturing comments
Ric Klaren
ric.klaren at gmail.com
Mon May 23 01:20:15 PDT 2005
Hi,
On 5/22/05, Jim Crafton <jim.crafton at gmail.com> wrote:
> 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?
Check out the hidden token stream examples in the distribution that
should get you started. There should also be a number of threads on
this topic in the archive (hidden token stream would probably be a
good search term).
Cheers,
Ric
More information about the antlr-interest
mailing list