[antlr-interest] Re: simple question
lloyd_from_far
ld at galador.net
Wed Oct 29 13:19:57 PST 2003
thanks Lubos.
I did think to that, but I need to know the EXACT number of space in
this particular case.
thought space should be dismissed any other time.
and that's part of the problem your solution, thought handy,
unfortunately seems to neglect ...
--- In antlr-interest at yahoogroups.com, "Lubos Vnuk"
<lubos.vnuk at r...> wrote:
> You might be mixing up the meaning of lexer and parser somewhat.
>
> I suggest you should get a single SELECT token, then a series of
ID
> tokens (ignoring the WS in the lexer), then a FROM token and an ID
> token. This would be the lexer's task.
>
> In your parser you define a rule to put it together, something
like
> this:
> select_stmt: SELECT (ID)+ FROM ID;
>
> I think you have a few SQL grammars at www.antlr.org to study from.
>
> HTH,
> Lubos.
>
> --- In antlr-interest at yahoogroups.com, "lloyd_from_far" <ld at g...>
> wrote:
> > given this (or change this tokens as you see fit):
> > SELECT: "SELECT" ;
> > FROM: "FROM" ;
> > NAME: options { testLiterals=true; }:
> > ( 'a' .. 'z' );
> > SPACE: (' ') +;
> >
> > how would you cut the following string:
> > "SELECT a field name with plenty of space FROM aTable"
> >
> > into the 4 following Tokens:
> > 'SELECT'
> > 'a field name with plenty of space'
> > 'FROM'
> > 'aTable'
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list