[antlr-interest] Re: whitespaces in middle of rule

William Lam <xeenman at yahoo.com> xeenman at yahoo.com
Wed Jan 22 19:57:15 PST 2003


good point and somewhat bad example, it is not illegal in java. 
Thanks!

--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at j...> 
wrote:
> 
> On Wednesday, January 22, 2003, at 06:22 PM, William Lam 
> <xeenman at y...> wrote:
> 
> > Sorry for this newbie question, but I wish to parse a grammar
> > such as a Java import statement i.e.
> >
> > import aaaa.bbbb.cccc.*;
> >
> > so I set up a grammar similar to this
> >
> > import_statement:
> >     "import" IDENT (DOT (IDENT | STAR))* SEMI
> >     ;
> >
> > The problem is that the rule will validate statments filled with
> > spaces, such as this
> >
> > import aaaa . bbbb . cccc . *;
> >
> > How do I make sure my import statements do not have any spaces?  I
> > notice that the example under antlr/examples/java exhibit this
> > problem.
> 
> Is it really illegal in Java?
> 
> Anyway, move it into the lexer if you need to.  Might be a 
> context-sensitive problem though then matching ID.
> 
> Ter
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Lecturer in Comp. Sci., University of San Francisco


 

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



More information about the antlr-interest mailing list