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