Found the solution!

 

You can retrieve comments from CommonTokenStream.

It contains all the tokens including tokens in the hidden channel.

 

Thanks everyone!

Jayani.

 

From: Jayani Withanawasam 
Sent: Tuesday, September 06, 2011 9:10 PM
To: [email protected].
Cc: Rajitha Jayawickrama
Subject: Get tokens in the Hidden channel 

 

Hi all,

 

In my lexer, the comments (single line and multi line) are sent to
hidden channel, thus prevent them from passing to the parser.

 

Here's the related code:

 

COMMENT     :     '--' (~('\r' | '\n'))* NLfrag { $channel = HIDDEN; }
;

 

Is there any way to get these tokens from hidden channel and do some
processing on them?

My target language is C# .Net 2.0 and ANTLR version is 3.1.

 

Appreciate your help on this.

 

Thanks,

Jayani Withanawasam

 


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to