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

Jim Idle jimi at temporal-wave.com
Tue Jul 31 11:31:36 PDT 2007


Whoops, I forgot to delete the comment consuming constructs!

COMMENT
     :   '/' '*' 
 		{	use existing input stream here and invoke your
     ;
 
LINE_COMMENT
     : '//' 
 
 		{ same deal  but to line end}
     ;

> 
> That's where the filtering lexer comes in. Just define the C comment
> rule, then when it matches, invoke your new ANTLR parser, with its own
> lexer, string stream and so on:
> 
> options
> {
>     filter	= true;
> }



More information about the antlr-interest mailing list