blob: 20a88acf4be41c7dddf6c39eb79499e849369ac6 [file] [log] [blame]
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001" Vim syntax file
2" Informix Structured Query Language (SQL) and Stored Procedure Language (SPL)
3" Language: SQL, SPL (Informix Dynamic Server 2000 v9.2)
4" Maintainer: Dean Hill <dhill@hotmail.com>
5" Last Change: 2004 Aug 30
6
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02007" quit when a syntax file was already loaded
8if exists("b:current_syntax")
Bram Moolenaard4755bb2004-09-02 19:12:26 +00009 finish
10endif
11
12syn case ignore
13
14
15
16" === Comment syntax group ===
17syn region sqlComment start="{" end="}" contains=sqlTodo
18syn match sqlComment "--.*$" contains=sqlTodo
19syn sync ccomment sqlComment
20
21
22
23" === Constant syntax group ===
24" = Boolean subgroup =
25syn keyword sqlBoolean true false
26syn keyword sqlBoolean null
27syn keyword sqlBoolean public user
28syn keyword sqlBoolean current today
29syn keyword sqlBoolean year month day hour minute second fraction
30
31" = String subgroup =
32syn region sqlString start=+"+ end=+"+
33syn region sqlString start=+'+ end=+'+
34
35" = Numbers subgroup =
36syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>"
37
38
39
40" === Statement syntax group ===
41" SQL
42syn keyword sqlStatement allocate alter
43syn keyword sqlStatement begin
44syn keyword sqlStatement close commit connect create
45syn keyword sqlStatement database deallocate declare delete describe disconnect drop
46syn keyword sqlStatement execute fetch flush free get grant info insert
47syn keyword sqlStatement load lock open output
48syn keyword sqlStatement prepare put
49syn keyword sqlStatement rename revoke rollback select set start stop
50syn keyword sqlStatement truncate unload unlock update
51syn keyword sqlStatement whenever
52" SPL
53syn keyword sqlStatement call continue define
54syn keyword sqlStatement exit
55syn keyword sqlStatement let
56syn keyword sqlStatement return system trace
57
58" = Conditional subgroup =
59" SPL
60syn keyword sqlConditional elif else if then
61syn keyword sqlConditional case
62" Highlight "end if" with one or more separating spaces
63syn match sqlConditional "end \+if"
64
65" = Repeat subgroup =
66" SQL/SPL
67" Handle SQL triggers' "for each row" clause and SPL "for" loop
68syn match sqlRepeat "for\( \+each \+row\)\="
69" SPL
70syn keyword sqlRepeat foreach while
71" Highlight "end for", etc. with one or more separating spaces
72syn match sqlRepeat "end \+for"
73syn match sqlRepeat "end \+foreach"
74syn match sqlRepeat "end \+while"
75
76" = Exception subgroup =
77" SPL
78syn match sqlException "on \+exception"
79syn match sqlException "end \+exception"
80syn match sqlException "end \+exception \+with \+resume"
81syn match sqlException "raise \+exception"
82
83" = Keyword subgroup =
84" SQL
85syn keyword sqlKeyword aggregate add as authorization autofree by
86syn keyword sqlKeyword cache cascade check cluster collation
87syn keyword sqlKeyword column connection constraint cross
88syn keyword sqlKeyword dataskip debug default deferred_prepare
89syn keyword sqlKeyword descriptor diagnostics
90syn keyword sqlKeyword each escape explain external
91syn keyword sqlKeyword file foreign fragment from function
92syn keyword sqlKeyword group having
93syn keyword sqlKeyword immediate index inner into isolation
94syn keyword sqlKeyword join key
95syn keyword sqlKeyword left level log
96syn keyword sqlKeyword mode modify mounting new no
97syn keyword sqlKeyword object of old optical option
98syn keyword sqlKeyword optimization order outer
99syn keyword sqlKeyword pdqpriority pload primary procedure
100syn keyword sqlKeyword references referencing release reserve
101syn keyword sqlKeyword residency right role routine row
102syn keyword sqlKeyword schedule schema scratch session set
103syn keyword sqlKeyword statement statistics synonym
104syn keyword sqlKeyword table temp temporary timeout to transaction trigger
105syn keyword sqlKeyword using values view violations
106syn keyword sqlKeyword where with work
107" Highlight "on" (if it's not followed by some words we've already handled)
108syn match sqlKeyword "on \+\(exception\)\@!"
109" SPL
110" Highlight "end" (if it's not followed by some words we've already handled)
111syn match sqlKeyword "end \+\(if\|for\|foreach\|while\|exception\)\@!"
112syn keyword sqlKeyword resume returning
113
114" = Operator subgroup =
115" SQL
116syn keyword sqlOperator not and or
117syn keyword sqlOperator in is any some all between exists
118syn keyword sqlOperator like matches
119syn keyword sqlOperator union intersect
120syn keyword sqlOperator distinct unique
121
122
123
124" === Identifier syntax group ===
125" = Function subgroup =
126" SQL
127syn keyword sqlFunction abs acos asin atan atan2 avg
128syn keyword sqlFunction cardinality cast char_length character_length cos count
129syn keyword sqlFunction exp filetoblob filetoclob hex
130syn keyword sqlFunction initcap length logn log10 lower lpad
131syn keyword sqlFunction min max mod octet_length pow range replace root round rpad
132syn keyword sqlFunction sin sqrt stdev substr substring sum
133syn keyword sqlFunction to_char tan to_date trim trunc upper variance
134
135
136
137" === Type syntax group ===
138" SQL
139syn keyword sqlType blob boolean byte char character clob
140syn keyword sqlType date datetime dec decimal double
141syn keyword sqlType float int int8 integer interval list lvarchar
142syn keyword sqlType money multiset nchar numeric nvarchar
143syn keyword sqlType real serial serial8 smallfloat smallint
144syn keyword sqlType text varchar varying
145
146
147
148" === Todo syntax group ===
149syn keyword sqlTodo TODO FIXME XXX DEBUG NOTE
150
151
152
153" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200154" Only when an item doesn't have highlighting yet
155command -nargs=+ HiLink hi def link <args>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000156
157
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200158" === Comment syntax group ===
159HiLink sqlComment Comment
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000160
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200161" === Constant syntax group ===
162HiLink sqlNumber Number
163HiLink sqlBoolean Boolean
164HiLink sqlString String
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000165
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200166" === Statment syntax group ===
167HiLink sqlStatement Statement
168HiLink sqlConditional Conditional
169HiLink sqlRepeat Repeat
170HiLink sqlKeyword Keyword
171HiLink sqlOperator Operator
172HiLink sqlException Exception
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000173
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200174" === Identifier syntax group ===
175HiLink sqlFunction Function
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000176
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200177" === Type syntax group ===
178HiLink sqlType Type
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000179
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200180" === Todo syntax group ===
181HiLink sqlTodo Todo
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000182
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200183delcommand HiLink
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000184
185let b:current_syntax = "sqlinformix"