[antlr-interest] Rule exception

Felipe Restrepo Calle frestrepo at dtic.ua.es
Mon Feb 9 08:53:43 PST 2009


Hi!

I'm new in ANTLR´ world. Id like to know how to add a rule exception. 
For example i have a rule for comments, that looks like:

COMMENT:    ( ';' | '//' ) .* NEWLINE { $channel = HIDDEN; } ;

But there is ONLY one special case where i need to catch something like: 
"//REG.........." and obviously  doesn't work because the compiler 
assume that it is another comment and hide it to the parser. how can i 
add a kind of exception to this rule that allow me to catch "//REG" and 
also other comments? thanks for any help.

Regards,

Felipe Restrepo




More information about the antlr-interest mailing list