[antlr-interest] end of file

Monty Zukowski monty at codetransform.com
Sun Jul 11 22:13:11 PDT 2004


You can specify EOF in your lexer too.

Or, don't have your comment rule eat the newline too.  Let the newline 
or whitespace rule do that.

Monty

On Jul 11, 2004, at 3:56 PM, clocKwize wrote:

> Hi there, I’m trying to implement single line comments, which is fine, 
> I use:
>
>  
>
> SL_COMMENT: "//" (~EOL)* EOL;
>
>  
>
> protected
>
> EOL:                 '\n' | '\r' | ('\r' '\n') | ('\n' '\r');
>
>  
>
> Which works for me – but then, what if there is no EOL, what if there 
> is a single line comment on the last line of the file, how can I add 
> that kind of thing into my grammar?
>
>  
>
>  
>
> Thanks.
>
>  
>
> Mike
>
>  
>
>
> Yahoo! Groups Links
>
> 	• 	To visit your group on the web, go to:
> http://groups.yahoo.com/group/antlr-interest/
>  
> 	• 	 To unsubscribe from this group, send an email to:
> antlr-interest-unsubscribe at yahoogroups.com
>  
> 	• 	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> Service.
>
>

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list