[antlr-interest] Re: comment must be preceded by whitespace

lgcraymer lgc at mail1.jpl.nasa.gov
Wed Mar 17 16:41:00 PST 2004


Take out the '\n', then--that's the only thing apart from EOF that can follow _~'\n)*.

--Loring


--- In antlr-interest at yahoogroups.com, "charlesskelton" <c.skelton at s...> wrote:
> Nice idea, but ynfortunately not - I need the \n to return as a 
> token by itself.
> 
> Any other suggestions?
> 
> Thanks,
> Charlie
> --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> 
> wrote:
> > On Mar 17, 2004, at 3:45 PM, charlesskelton wrote:
> > 
> > > I'm new to antlr.
> > >
> > > I'm trying to write lexer for a language, k, in which single line
> > > comments begin with a '/'. If there is no whitespace before 
> the '/',
> > > or the '/' is not in column 1, then it is not a comment.
> > 
> > Try
> > 
> > comment : {getColumn()==1}? '/' (~'\n')* '\n' {newline();} ;
> > 
> > would that work?
> > 
> > Ter
> > --
> > Professor Comp. Sci., University of San Francisco
> > Creator, ANTLR Parser Generator, http://www.antlr.org
> > Cofounder, http://www.jguru.com
> > Cofounder, http://www.knowspam.net enjoy email again!
> > Cofounder, http://www.peerscope.com pure link sharing



 
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