Subject Re: [Firebird-general] Re: vim Syntax File
Author Scott Morgan
On 13/06/14 15:45, mapopa@... [Firebird-general] wrote:
> We need to create a Firebird dialect
>
> http://vimdoc.sourceforge.net/htmldoc/ft_sql.html#sql-dialects

> ps: if you have time please contribute

Had a quick stab at it, never done anything like this before.

Took the list of Firebird keywords from here:
http://www.firebirdsql.org/refdocs/langrefupd25-reskeywords-full-keywords.html

And added on types to them (not all of them currently)
http://pastebin.com/4J1ZgLMf
(also added the 'SHELL' keyword, which isn't technically part of FB's
dialect but crops up in ISQL scripts)

Then, based on the sqloracle.vim file, I built sqlfirebird.vim:
http://pastebin.com/DNag96VC
(Have a Lua script that does the work)

It's not perfect but it works okay.

Lots of keywords are unassigned a type so they just get a default highlight.

Problems:
* Some of the operators don't match (e.g. "||", "~="...)
* Some keywords have different meaning based on context (i.e. 'LEFT'
is both a statement keyword as in 'LEFT OUTER JOIN' and a function)
I suspect you could do some fancy work with nestled ranges but,
heh, lot of work there (doesn't seem like anyone else has tried it
for the other SQL dialects either)
* Haven't looked into how well it works with procedure definitions yet
(probably a lot of the unassigned keywords relevant to that)

Might set up a github project if anyone's interested (or whatever works
best for the vim team)

Scott