Greetings!
On Sat, 2009-10-24 at 17:40 +0100, Peter Boughton wrote:
> How do I support nested comments with ANTLR?
> 

This is what I use:

// multiple-line comments
ML_COMMENT : NESTED_COMMENTARY { $channel=HIDDEN; } ;

fragment NESTED_COMMENTARY :
      '/*'
      ( options {greedy=false;} : . )*
      ( NESTED_COMMENTARY ( options {greedy=false;} : . )* )*
      '*/'
   ;

(note that this works using ANTLR 3.1.3 from Mar 2009, kinda old but I
think should still work with current ANTLR versions)

Perhaps you can adapt it to your language....
Hope this helps
   -jbb



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 il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to