Hello all,

I have a need to have an exception to my comment rule that I want to know the 
best way to handle.  Basically, I need to not treat something that starts with, 
say, #ABCD as not a comment. (This is for backward compatibility.)

For example:
# This is a comment
Something = value;
#ABCD This = that
This needs to treat the third line as if the #ABCD didn't exist.  So I'm trying 
something like this:

fragment  NONCOMMENT :  '#ABCD' ;

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

This seems to work fine, but when I check the grammar, I get a warning that 
#ABCD can match multiple alternatives and so the second alternative is 
disabled.  This is the desired behavior, of course, but since it gives me a 
warning, I wonder if there a better way to switch off treating this thing that 
looks like a comment as a comment.

Thanks,
-JEEP
Joe Peterson

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

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

Reply via email to