[antlr-interest] parsing only inside of C Comments?

Jim Idle jimi at temporal-wave.com
Tue Jul 31 10:55:56 PDT 2007


Martin,

I should think that the easiest way to do this is to write the grammar
that parses those patterns, then write a separate filtering lexer that
invokes the parser on the discovered text in the way that island
grammars do when you can invoke them from the lexing phase. There is an
example of using islan grammars with the Java and C targets (others?) in
the dowloadable examples jar at the download page:

http://www.antlr.org/download.html

The only difference would be that you have a filtering lexer only, and
not an initial parser that switches to the island grammar in its lexing
phase.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Martin Kortmann
> Sent: Tuesday, July 31, 2007 7:33 AM
> To: antlr-interest Interest
> Subject: [antlr-interest] parsing only inside of C Comments?
> 
> Hello,
> 
> I like to parse some pattern that occur only inside
> of C Comments. Everything other should be ignored.
> Has someone any Hints for me how i this can be done?
> 
> Martin


More information about the antlr-interest mailing list