Mercurial > vim
annotate runtime/syntax/sqlhana.vim @ 15464:3faa7cc8207c v8.1.0740
patch 8.1.0740: Tcl test fails
commit https://github.com/vim/vim/commit/8309b0559da6e9a581a7816572594c90c2d7f942
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 16:46:22 2019 +0100
patch 8.1.0740: Tcl test fails
Problem: Tcl test fails.
Solution: When the argument is empty don't give an error, instead rely on
the error reporting higher up.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 17:00:06 +0100 |
parents | 43efa4f5a8ea |
children |
rev | line source |
---|---|
3920 | 1 " Vim syntax file |
2 " Language: SQL, SAP HANA In Memory Database | |
3 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> | |
4 " Last Change: 2012 Oct 23 | |
5 " Version: SP4 b (Q2 2012) | |
6 " Homepage: http://www.vim.org/scripts/script.php?script_id=4275 | |
7 | |
8 " Description: Updated to SAP HANA SP4 | |
9 " | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3920
diff
changeset
|
10 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3920
diff
changeset
|
11 if exists("b:current_syntax") |
3920 | 12 finish |
13 endif | |
14 | |
15 syn case ignore | |
16 | |
17 " The SQL reserved words, defined as keywords. | |
18 " These were pulled from the following SQL reference: | |
19 " http://help.sap.com/hana/hana_sql_en.pdf | |
20 " An easy approach is to copy all text from the PDF | |
21 " into a Vim buffer. The keywords are in UPPER case, | |
22 " so you can run the following commands to be left with | |
23 " mainly the UPPER case words: | |
24 " 1. Delete all words that do not begin with a Capital | |
25 " %s/\(\<[^A-Z]\w*\>\)//g | |
26 " 2. Remove all words where the 2nd letter is not a Capital | |
27 " %s/\(\<[A-Z][^A-Z]\w*\>\)//g | |
28 " 3. Remove all non-word (or space) characters | |
29 " %s/[^0-9A-Za-z_ ]*//g | |
30 " 4. Remove some known words | |
31 " %s/\<\(SAP\|HANA\|OK\|AG\|IBM\|DB2\|AIX\|POWER\d\+\|UNIX\)\>//g | |
32 " 5. Remove blank lines and trailing spaces | |
33 " %s/\s\+$//g | |
34 " %s/^\s\+//g | |
35 " %s/^$\n//g | |
36 " 6. Convert spaces to newlines remove single character | |
37 " %s/[ ]\+/\r/g | |
38 " %g/^\w$/d | |
39 " 7. Sort and remove duplicates | |
40 " :sort | |
41 " :Uniq | |
42 " 8. Use the WhatsMissing plugin against the sqlhana.vim file. | |
43 " 9. Generated a file of all UPPER cased words which should not | |
44 " be in the syntax file. These items should be removed | |
45 " from the list in step 7. You can use WhatsNotMissing | |
46 " between step 7 and this new file to weed out the words | |
47 " we know are not syntax related. | |
48 " 10. Use the WhatsMissingRemoveMatches to remove the words | |
49 " from step 9. | |
50 | |
51 syn keyword sqlSpecial false null true | |
52 | |
53 " Supported Functions for Date/Time types | |
54 syn keyword sqlFunction ADD_DAYS ADD_MONTHS ADD_SECONDS ADD_YEARS COALESCE | |
55 syn keyword sqlFunction CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_UTCDATE | |
56 syn keyword sqlFunction CURRENT_UTCTIME CURRENT_UTCTIMESTAMP | |
57 syn keyword sqlFunction DAYNAME DAYOFMONTH DAYOFYEAR DAYS_BETWEEN EXTRACT | |
58 syn keyword sqlFunction GREATEST HOUR IFNULL ISOWEEK LAST_DAY LEAST LOCALTOUTC | |
59 syn keyword sqlFunction MINUTE MONTH MONTHNAME NEXT_DAY NOW QUARTER SECOND | |
60 syn keyword sqlFunction SECONDS_BETWEEN UTCTOLOCAL WEEK WEEKDAY YEAR | |
61 | |
62 syn keyword sqlFunction TO_CHAR TO_DATE TO_DATS TO_NCHAR TO_TIME TO_TIMESTAMP UTCTOLOCAL | |
63 | |
64 " Aggregate | |
65 syn keyword sqlFunction COUNT MIN MAX SUM AVG STDDEV VAR | |
66 | |
67 " Datatype conversion | |
68 syn keyword sqlFunction CAST TO_ALPHANUM TO_BIGINT TO_BINARY TO_BLOB TO_CHAR TO_CLOB | |
69 syn keyword sqlFunction TO_DATE TO_DATS TO_DECIMAL TO_DOUBLE TO_INT TO_INTEGER TO_NCHAR | |
70 syn keyword sqlFunction TO_NCLOB TO_NVARCHAR TO_REAL TO_SECONDDATE TO_SMALLDECIMAL | |
71 syn keyword sqlFunction TO_SMALLINT TO_TIME TO_TIMESTAMP TO_TINYINT TO_VARCHAR TO_VARBINARY | |
72 | |
73 " Number functions | |
74 syn keyword sqlFunction ABS ACOS ASIN ATAN ATAN2 BINTOHEX BITAND CEIL COS COSH COT | |
75 syn keyword sqlFunction EXP FLOOR GREATEST HEXTOBIN LEAST LN LOG MOD POWER ROUND | |
76 syn keyword sqlFunction SIGN SIN SINH SQRT TAN TANH UMINUS | |
77 | |
78 " String functions | |
79 syn keyword sqlFunction ASCII CHAR CONCAT LCASE LENGTH LOCATE LOWER LPAD LTRIM | |
80 syn keyword sqlFunction NCHAR REPLACE RPAD RTRIM SUBSTR_AFTER SUBSTR_BEFORE | |
81 syn keyword sqlFunction SUBSTRING TRIM UCASE UNICODE UPPER | |
82 | |
83 " Miscellaneous functions | |
84 syn keyword sqlFunction COALESCE CURRENT_CONNECTION CURRENT_SCHEMA CURRENT_USER | |
85 syn keyword sqlFunction GROUPING_ID IFNULL MAP NULLIF SESSION_CONTEXT SESSION_USER SYSUUIDSQL | |
86 syn keyword sqlFunction GET_NUM_SERVERS | |
87 | |
88 | |
89 " sp_ procedures | |
90 " syn keyword sqlFunction sp_addalias | |
91 | |
92 | |
93 " Reserved keywords | |
94 syn keyword sqlkeyword ALL AS AT BEFORE | |
95 syn keyword sqlkeyword BEGIN BOTH BY | |
96 syn keyword sqlkeyword CONDITION | |
97 syn keyword sqlkeyword CURRVAL CURSOR DECLARE | |
98 syn keyword sqlkeyword DISTINCT DO ELSE ELSEIF ELSIF | |
99 syn keyword sqlkeyword END EXCEPTION EXEC | |
100 syn keyword sqlkeyword FOR FROM GROUP | |
101 syn keyword sqlkeyword HAVING IN | |
102 syn keyword sqlkeyword INOUT INTO IS | |
103 syn keyword sqlkeyword LEADING | |
104 syn keyword sqlkeyword LOOP MINUS NATURAL NEXTVAL | |
105 syn keyword sqlkeyword OF ON ORDER OUT | |
106 syn keyword sqlkeyword PRIOR RETURN RETURNS REVERSE | |
107 syn keyword sqlkeyword ROWID SELECT | |
108 syn keyword sqlkeyword SQL START STOP SYSDATE | |
109 syn keyword sqlkeyword SYSTIME SYSTIMESTAMP SYSUUID | |
110 syn keyword sqlkeyword TRAILING USING UTCDATE | |
111 syn keyword sqlkeyword UTCTIME UTCTIMESTAMP VALUES | |
112 syn keyword sqlkeyword WHILE | |
113 syn keyword sqlkeyword ANY SOME EXISTS ESCAPE | |
114 | |
115 " IF keywords | |
116 syn keyword sqlkeyword IF | |
117 | |
118 " CASE keywords | |
119 syn keyword sqlKeyword WHEN THEN | |
120 | |
121 " Syntax rules common to TEXT and SHORTTEXT keywords | |
122 syn keyword sqlKeyword LANGUAGE DETECTION LINGUISTIC | |
123 syn keyword sqlkeyword MIME TYPE | |
124 syn keyword sqlkeyword EXACT WEIGHT FUZZY FUZZINESSTHRESHOLD SEARCH | |
125 syn keyword sqlkeyword PHRASE INDEX RATIO REBUILD | |
126 syn keyword sqlkeyword CONFIGURATION | |
127 syn keyword sqlkeyword SEARCH ONLY | |
128 syn keyword sqlkeyword FAST PREPROCESS | |
129 syn keyword sqlkeyword SYNC SYNCHRONOUS ASYNC ASYNCHRONOUS FLUSH QUEUE | |
130 syn keyword sqlkeyword EVERY AFTER MINUTES DOCUMENTS SUSPEND | |
131 | |
132 " Statement keywords (i.e. after ALTER or CREATE) | |
133 syn keyword sqlkeyword AUDIT POLICY | |
134 syn keyword sqlkeyword FULLTEXT | |
135 syn keyword sqlkeyword SEQUENCE RESTART | |
136 syn keyword sqlkeyword TABLE | |
137 syn keyword sqlkeyword PROCEDURE STATISTICS | |
138 syn keyword sqlkeyword SCHEMA | |
139 syn keyword sqlkeyword SYNONYM | |
140 syn keyword sqlkeyword VIEW | |
141 syn keyword sqlkeyword COLUMN | |
142 syn keyword sqlkeyword SYSTEM LICENSE | |
143 syn keyword sqlkeyword SESSION | |
144 syn keyword sqlkeyword CANCEL WORK | |
145 syn keyword sqlkeyword PLAN CACHE | |
146 syn keyword sqlkeyword LOGGING NOLOGGING RETENTION | |
147 syn keyword sqlkeyword RECONFIGURE SERVICE | |
148 syn keyword sqlkeyword RESET MONITORING | |
149 syn keyword sqlkeyword SAVE DURATION PERFTRACE FUNCTION_PROFILER | |
150 syn keyword sqlkeyword SAVEPOINT | |
151 syn keyword sqlkeyword USER | |
152 syn keyword sqlkeyword ROLE | |
153 syn keyword sqlkeyword ASC DESC | |
154 syn keyword sqlkeyword OWNED | |
155 syn keyword sqlkeyword DEPENDENCIES SCRAMBLE | |
156 | |
157 " Create sequence | |
158 syn keyword sqlkeyword INCREMENT MAXVALUE MINVALUE CYCLE | |
159 | |
160 " Create table | |
161 syn keyword sqlkeyword HISTORY GLOBAL LOCAL TEMPORARY | |
162 | |
163 " Create trigger | |
164 syn keyword sqlkeyword TRIGGER REFERENCING EACH DEFAULT | |
165 syn keyword sqlkeyword SIGNAL RESIGNAL MESSAGE_TEXT OLD NEW | |
166 syn keyword sqlkeyword EXIT HANDLER SQL_ERROR_CODE | |
167 syn keyword sqlkeyword TARGET CONDITION SIGNAL | |
168 | |
169 " Alter table | |
170 syn keyword sqlkeyword ADD DROP MODIFY GENERATED ALWAYS | |
171 syn keyword sqlkeyword UNIQUE BTREE CPBTREE PRIMARY KEY | |
172 syn keyword sqlkeyword CONSTRAINT PRELOAD NONE | |
173 syn keyword sqlkeyword ROW THREADS BATCH | |
174 syn keyword sqlkeyword MOVE PARTITION TO LOCATION PHYSICAL OTHERS | |
175 syn keyword sqlkeyword ROUNDROBIN PARTITIONS HASH RANGE VALUE | |
176 syn keyword sqlkeyword PERSISTENT DELTA AUTO AUTOMERGE | |
177 | |
178 " Create audit policy | |
179 syn keyword sqlkeyword AUDITING SUCCESSFUL UNSUCCESSFUL | |
180 syn keyword sqlkeyword PRIVILEGE STRUCTURED CHANGE LEVEL | |
181 syn keyword sqlkeyword EMERGENCY ALERT CRITICAL WARNING INFO | |
182 | |
183 " Privileges | |
184 syn keyword sqlkeyword DEBUG EXECUTE | |
185 | |
186 " Schema | |
187 syn keyword sqlkeyword CASCADE RESTRICT PARAMETERS SCAN | |
188 | |
189 " Traces | |
190 syn keyword sqlkeyword CLIENT CRASHDUMP EMERGENCYDUMP | |
191 syn keyword sqlkeyword INDEXSERVER NAMESERVER DAEMON | |
192 syn keyword sqlkeyword CLEAR REMOVE TRACES | |
193 | |
194 " Reclaim | |
195 syn keyword sqlkeyword RECLAIM DATA VOLUME VERSION SPACE DEFRAGMENT SPARSIFY | |
196 | |
197 " Join | |
198 syn keyword sqlkeyword INNER OUTER LEFT RIGHT FULL CROSS JOIN | |
199 syn keyword sqlkeyword GROUPING SETS ROLLUP CUBE | |
200 syn keyword sqlkeyword BEST LIMIT OFFSET | |
201 syn keyword sqlkeyword WITH SUBTOTAL BALANCE TOTAL | |
202 syn keyword sqlkeyword TEXT_FILTER FILL UP SORT MATCHES TOP | |
203 syn keyword sqlkeyword RESULT OVERVIEW PREFIX MULTIPLE RESULTSETS | |
204 | |
205 " Lock | |
206 syn keyword sqlkeyword EXCLUSIVE MODE NOWAIT | |
207 | |
208 " Transaction | |
209 syn keyword sqlkeyword TRANSACTION ISOLATION READ COMMITTED | |
210 syn keyword sqlkeyword REPEATABLE SERIALIZABLE WRITE | |
211 | |
212 " Saml | |
213 syn keyword sqlkeyword SAML ASSERTION PROVIDER SUBJECT ISSUER | |
214 | |
215 " User | |
216 syn keyword sqlkeyword PASSWORD IDENTIFIED EXTERNALLY ATTEMPTS ATTEMPTS | |
217 syn keyword sqlkeyword ENABLE DISABLE OFF LIFETIME FORCE DEACTIVATE | |
218 syn keyword sqlkeyword ACTIVATE IDENTITY KERBEROS | |
219 | |
220 " Grant | |
221 syn keyword sqlkeyword ADMIN BACKUP CATALOG SCENARIO INIFILE MONITOR | |
222 syn keyword sqlkeyword OPTIMIZER OPTION | |
223 syn keyword sqlkeyword RESOURCE STRUCTUREDPRIVILEGE TRACE | |
224 | |
225 " Import | |
226 syn keyword sqlkeyword CSV FILE CONTROL NO CHECK SKIP FIRST LIST | |
227 syn keyword sqlkeyword RECORD DELIMITED FIELD OPTIONALLY ENCLOSED FORMAT | |
228 | |
229 " Roles | |
230 syn keyword sqlkeyword PUBLIC CONTENT_ADMIN MODELING MONITORING | |
231 | |
232 " Miscellaneous | |
233 syn keyword sqlkeyword APPLICATION BINARY IMMEDIATE COREFILE SECURITY DEFINER | |
234 syn keyword sqlkeyword DUMMY INVOKER MATERIALIZED MESSEGE_TEXT PARAMETER PARAMETERS | |
235 syn keyword sqlkeyword PART | |
236 syn keyword sqlkeyword CONSTANT SQLEXCEPTION SQLWARNING | |
237 | |
238 syn keyword sqlOperator WHERE BETWEEN LIKE NULL CONTAINS | |
239 syn keyword sqlOperator AND OR NOT CASE | |
240 syn keyword sqlOperator UNION INTERSECT EXCEPT | |
241 | |
242 syn keyword sqlStatement ALTER CALL CALLS CREATE DROP RENAME TRUNCATE | |
243 syn keyword sqlStatement DELETE INSERT UPDATE EXPLAIN | |
244 syn keyword sqlStatement MERGE REPLACE UPSERT SELECT | |
245 syn keyword sqlStatement SET UNSET LOAD UNLOAD | |
246 syn keyword sqlStatement CONNECT DISCONNECT COMMIT LOCK ROLLBACK | |
247 syn keyword sqlStatement GRANT REVOKE | |
248 syn keyword sqlStatement EXPORT IMPORT | |
249 | |
250 | |
251 syn keyword sqlType DATE TIME SECONDDATE TIMESTAMP TINYINT SMALLINT | |
252 syn keyword sqlType INT INTEGER BIGINT SMALLDECIMAL DECIMAL | |
253 syn keyword sqlType REAL DOUBLE FLOAT | |
254 syn keyword sqlType VARCHAR NVARCHAR ALPHANUM SHORTTEXT VARBINARY | |
255 syn keyword sqlType BLOB CLOB NCLOB TEXT DAYDATE | |
256 | |
257 syn keyword sqlOption Webservice_namespace_host | |
258 | |
259 " Strings and characters: | |
260 syn region sqlString start=+"+ end=+"+ contains=@Spell | |
261 syn region sqlString start=+'+ end=+'+ contains=@Spell | |
262 | |
263 " Numbers: | |
264 syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>" | |
265 | |
266 " Comments: | |
267 syn region sqlDashComment start=/--/ end=/$/ contains=@Spell | |
268 syn region sqlSlashComment start=/\/\// end=/$/ contains=@Spell | |
269 syn region sqlMultiComment start="/\*" end="\*/" contains=sqlMultiComment,@Spell | |
270 syn cluster sqlComment contains=sqlDashComment,sqlSlashComment,sqlMultiComment,@Spell | |
271 syn sync ccomment sqlComment | |
272 syn sync ccomment sqlDashComment | |
273 syn sync ccomment sqlSlashComment | |
274 | |
275 hi def link sqlDashComment Comment | |
276 hi def link sqlSlashComment Comment | |
277 hi def link sqlMultiComment Comment | |
278 hi def link sqlNumber Number | |
279 hi def link sqlOperator Operator | |
280 hi def link sqlSpecial Special | |
281 hi def link sqlKeyword Keyword | |
282 hi def link sqlStatement Statement | |
283 hi def link sqlString String | |
284 hi def link sqlType Type | |
285 hi def link sqlFunction Function | |
286 hi def link sqlOption PreProc | |
287 | |
288 let b:current_syntax = "sqlhana" | |
289 | |
290 " vim:sw=4: |