[antlr-interest] Auto- completion feature based on ANTLR
Ruslan Zasukhin
sunshine at public.kherson.ua
Tue Aug 19 03:52:38 PDT 2003
on 8/18/03 21:18, Terence Parr at parrt at cs.usfca.edu wrote:
> Hi. Auto-completion is not really convenient in the current generated
> output. It's kind of like compiling C code w/o the symbol table
> information (-g option). The current ANTLR 3 analysis engine I'm
> working on makes this sort of thing trivial, but of course doesn't
> exist as a tool yet. :(
>
> You might be able to do something interesting with the bitsets used for
> prediction. These say what tokens predict which alternative. The
> union of these at any decision point tells you what can come next. The
> problem is when there is no decision:
>
> a : A B ;
>
> from A to B you make no decision and you would not have sets laying
> around to say "B" can come next. ON the other hand, you might be able
> to tweak the code generator to dump a bit more info for these single
> token matches.
>
> Still it won't be convenient. :(
Yes true.
Terr, as I see the task, we need some simple function
That must return LIST / Array of next expected tokens.
As tokens we can have
1) simply strings "select"
But I think this will not work because
2) in SQL we can get as next token a FIELD.
So I need self then construct array of field names that exists in my
database.
I.e. I think ANTLR should return me { SELECT_TOKEN, FIELD }
And later I will need just add function
Array<string> BuildStrings( ListOfTokens )
{
for each token from list
switch( token )
{
case SELECT: res.add( "select" )
case FIELD: AddFields( res, ... )
...
}
}
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list