[antlr-interest] How to get a list of all valid options for the next token?

Kay Röpke kroepke at classdump.org
Wed Aug 13 16:55:57 PDT 2008


Hi!

On Aug 14, 2008, at 1:05 AM, Raphael Reitzig wrote:

> You mentioned syntax highlighting. This is a different thing. Syntax  
> highlighting does not show you: "Well, you could start an variable  
> declaration, an assignment, an if statement, ..., here", but only  
> available methods on objects (at least those IDEs I know). This is  
> stuff you can gather from sources/object files, store somewhere  
> central staticaly. No need to look something up in any gramar while  
> you're typing.


Yeah, highlighting doesn't need it.
I recently came across a request (or rather a wish) to support  
completion in sql statements, though. That would really benefit from  
this type of information, for example if you could tell that at the  
current input location only column names (or db.table.col or similar)  
is allowed, you could provide really smart completion.
Mix in semantic information (i'm in expr and the currently available  
tables are t1,t2: show completions only for columns of those tables,  
then present function names) and you get a pretty cool development  
environment :)

I've yet to explore that alley, but that information would be very  
valuable to get at. Performance shouldn't be much of an issue, as it  
would like be in an interactive environment and the possible states  
would be finite (=precomputed from the grammar).

cheers,
-k
-- 
Kay Röpke
http://classdump.org/








More information about the antlr-interest mailing list