[antlr-interest] Code completion, possible with JavaScript output?

Andreas Stefik stefika at gmail.com
Fri Jun 17 08:16:11 PDT 2011


David,

This might not be an exact answer to your question, but the easiest
way I've found to do things like this is to read in the .tokens file
generated by antlr. For example, we do this to send keyword lists to
the NetBeans Platform for syntax highlighting, which works fine. I can
send a code example if necessary.

As for popping up a list for code completion, there are lots of ways
to do it. If you are using a rich client platform (e.g., eclipse,
netbeans), there are standard APIs for it, with corresponding
tutorials. Here is an example of one from NetBeans, for example:

http://platform.netbeans.org/tutorials/nbm-code-completion.html

So, basically, you read in the tokens file at bootup, you are
typically sent a position for where the cursor is in a file, then you
somehow decide, depending on what specifically you need and how far
you want to go with it, what words are populated in the list when the
user selects code completion.

Hope that helps,

Stefik

On Fri, Jun 17, 2011 at 7:07 AM, David Wynter <david_wynter at yahoo.com> wrote:
> Hi,
>
> I have had a look thru the ANTLR documentation and could not find what I was looking for. New to ANTLR.
>
> I have a SQL database with 400 tables and want to produce a parser for a language I convert to SQL for querying 3 different domains within that model.
> The application uses a Web interface so the search command line parser has to be in Javascript.
> I intend to use a grammar base don a subset of the SQL grammar <search condition>
> The users of the query languages (3, one for each domain) will need help on determining the terms we use for the column names.
> For example they might type "WHERE interestrate > 1% AND interestrate < 3%" where interestrate is a column name.
> We will map these to tablename.columnname. so only single words in a reserved set are required.
> The 3 grammars are the same except they have different reserved words.
> OK to include the reserved words in the grammar itself, these are DSLs.
>
> My question is, is there the ability to search the list of these reserved words as they type (characters as token I expect) and auto suggest in a list the possible entries?
> So if "interestrate" and "interbreeding" were 2 of the reserved words then these would be suggested in a list right up until they typed the 6th character.
>
> Thanks,
>
> David
>
> 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