[antlr-interest] "Comments" token from source to the target language
Terence Parr
parrt at cs.usfca.edu
Mon Nov 12 14:03:03 PST 2007
On Nov 12, 2007, at 11:38 AM, Mateus Baur da Silva wrote:
> Hi Guys,
>
> As I mentioned in some my other email, I doing a translator from a
> Pascal subset to java. Currently, I'm ignoring the "comments" by
> using skip() on the lexer rule that defines the "comments".
>
> However, I would like to translate the comments from Pascal to Java
> code as well. I was wondering if I could do that by using the
> HIDDEN_CHANNEL or some other feature to properly translate the
> comments. Does someone have any clue on how to do that?
>
Yep, use the hidden token thing. Your actions then ask for the
hidden tokens between real tokens. Parser ignores them.
Ter
More information about the antlr-interest
mailing list