[antlr-interest] Re: Auto- completion feature based on ANTLR

Thomas Brandon tom at psy.unsw.edu.au
Wed Aug 20 20:47:57 PDT 2003

If you want to see an implementation of code completion you could 
look at the Netbeans IDE (www.netbeans.org, and specifically 
editor.netbeans.org). I had a quick look and the only docs on it are 
user-view docs, but there's a full implementation in there. It does 
code-completion for at least Java and HTML. The implementation is 
language specific though there is a move to pull it out into a 
seperate code-completion module but I don't think this is underway 
yet and again no in-depth programmer docs yet. I think that the Java 
editor uses a hand-built parser.

As with other tools though it's only method completion, no completion 
for keywords as you were talking about. This makes it rather easier 
as then you don't have to deal with incomplete tokens, it's already 
an IDENT (or FIELD_IDENT or TABLE_IDENT) token you just check how it 
could be expanded.

As to keywords, you could drop this in favour of abbreviations which 
is what Netbeans has. e.g. 're' is expanded to 'return'. Though this 
can be a bit annoying as a variable called 're' gets expanded 
to 'return'. But it might be worth thinking about whether it's worth 
having keyword completion. Field\table etc name completion is great 
as you don't have to know them all off by heart but who's gonna 
forget select. And if you had say loj->LEFT OUTER JOIN abbreviations 
and so on you could take care of the longer sequences, there aren't 
many long sequences in SQL. You could even do them outside the ANTLR 
parser, have your Editor Kit do it before lexing\parsing. When a 
space (or whatever you're abbreviation key is) is inserted check what 
it was inserted after. Though depending on your editor implementation 
that may or may not be easy, with a Swing editor kit it wouldn't be 
too bad.

--- In antlr-interest at yahoogroups.com, Ruslan Zasukhin 
<sunshine at p...> wrote:
> Interesting how this task resolve Microsoft Visual C++, or 
> CodeWarrior...
> Best regards,
> Ruslan Zasukhin      [ I feel the need...the need for speed ]
> -------------------------------------------------------------
> e-mail: ruslan at p...
> 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