[antlr-interest] Calculating valid tokens for content assist

Balint Torok 12toba at gmail.com
Sat May 7 04:17:14 PDT 2011


Hello!

I have a project in Eclipse where I have an editor for a custom
language. I am using ANTLR to generate the compiler for it. What I
need is to add content assist to the editor.

The input is a source code in the custom language, and the position of
the character where the user requested content assist. The source code
is most of time incomplete as the user can ask for content assist any
time. What I need is to calculate the list of possible tokens that are
valid for the given position.

It is possible to write a custom code to do the calculation, but that
code would have to be manually kept in sync with the grammar. I
figured the parser is doing something similar. It has to be able to
determine at a given context what are the acceptable tokens. Is it
possible to "reuse" that? What is the best practice in creating
content assist anyway?


More information about the antlr-interest mailing list