Am Tuesday 09 June 2009 12:01:41 schrieb virg g:
> Hi,
>
> COMMENT : '\'' ~('\n'|'\r')* {$channel=HIDDEN;} ;
>
> This is working well, if there is no single quote occurs within the
> instruction. If single quote occurs in the instruction other than at the
> beginning of the file, the text after single quote is treating as a
> comment. So How to write a rule only if line starts with single quote then
> it is comment not any where else? please help me.

do you have a rule for NL? Something like
NL: '\r'? '\n' ;  // or similar...

does it work to change it to:
NL: ('\r'? '\n')+ (  '\'' ~('\n'|'\r')* )?  ;  // to include a following 
comment

or a semantic predicate which tests the column number

or maybe it's easier to use a  file reader which just drops the lines 
beginning with a '   :-)

cheers,
 Michael



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