[antlr-interest] Calculating valid tokens for content assist

Balint Torok 12toba at gmail.com
Sat May 7 14:51:44 PDT 2011


Yes I saw Xtext. It is a fabulous thing. Really it is. Unfortunately
it didn't suite our purpose. Xtext generates a full blown Eclipse
editor, but what we needed is only an editor-like widget that we can
put into an Eclipse view and on a wizard. Also we don't use EMF while
Xtext is built around it.
Your question is very much valid, what we need is much like what Xtext
generates. But for the reasons above we had to roll our own solution
and it turned out to be quite OK, except for the content assist. That
is where we need some advice.

Thanks,
Balint

On Sat, May 7, 2011 at 3:15 PM, Lars von Wedel <lars.vonwedel at gmail.com> wrote:
> Did you have a look at Xtext ? It does what you want and uses Antlr under the hood. Therefore, converting your existing grammar might be feasible.
>
> Lars
>
>
> Am 07.05.2011 um 13:17 schrieb Balint Torok <12toba at gmail.com>:
>
>> 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?
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list