Support for custom SQL-extending grammar

I'd like to write a plugin for supporting SQL-extending grammar. I thought about implementing custom annotator but can't specify language SQL in plugin.xml. Started to implement custom language support, describes new keywords in bnf but do not want to describe SQL syntax. What do you advise?

7 comments
Comment actions Permalink

What language do you work on?

0
Comment actions Permalink

We have a custom tool for applying and reverting migrations. SQL script surrounds with some meta information about migration. Also, there are a few new shortcuts for replacing SQL boilerplate. The tool that can parse and execute this scripts.

It may looks like:

AUTHOR ivan.ivanov;

BEGIN MIGRATION WITH AUTO UNDO

CREATE TABLE user (
id INTEGER NOT NULL PRIMARY KEY,
firstname TEXT NOT NULL
);
CREATE INDEX i_user_firstname ON user(firstname);

END MIGRATION
0
Comment actions Permalink

I follow the instructions to support syntax but do not know how to work with SQL inside migration. And is there any way to expand SQL syntax with new words.

0
Comment actions Permalink

I'd try to implement a separate template language instead

see com.intellij.psi.templateLanguages.TemplateLanguage API

 

0
Comment actions Permalink

Could you please provide any examples or links to documentation

0

Please sign in to leave a comment.