[antlr-interest] Need pointers for getting comment statements in trees produced by v3 grammer files

Bart Kiers bkiers at gmail.com
Mon Apr 11 10:39:10 PDT 2011


On Mon, Apr 11, 2011 at 6:31 PM, The Researcher <researcher0x00 at gmail.com>wrote:

> > Hi Ankit,
>
>
> If I understand the question correctly,
> then have you tried removing {$channel=HIDDEN;} from the lexer rule?
>
> i.e.
> LINE_COMMENT
>   :   '//' ~('\n' | '\r')* '\r'? '\n' {$channel=HIDDEN;}
>   ;
>
> should be
>
>  LINE_COMMENT
>   :   '//' ~('\n' | '\r')* '\r'? '\n'
>   ;
>
> Eric
> <http://www.antlr.org/mailman/options/antlr-interest/your-email-address>
>

But then (one of) the parser rules should also include this LINE_COMMENT
somewhere, of course.

Regards,

Bart.


More information about the antlr-interest mailing list