[antlr-interest] comment must be preceded by whitespace
Terence Parr
parrt at cs.usfca.edu
Wed Mar 17 16:09:54 PST 2004
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