xref: /vim-8.2.3635/runtime/syntax/sqloracle.vim (revision cf2d8dee)
1" Vim syntax file
2" Language:	SQL, PL/SQL (Oracle 11g)
3" Maintainer:	Christian Brabandt
4" Repository:   https://github.com/chrisbra/vim-sqloracle-syntax
5" License:      Vim
6" Previous Maintainer:	Paul Moore
7" Last Change:	2015 Nov 24
8
9if exists("b:current_syntax")
10  finish
11endif
12
13syn case ignore
14
15" The SQL reserved words, defined as keywords.
16
17syn keyword sqlSpecial	false null true
18
19syn keyword sqlKeyword	access add as asc begin by case check cluster column
20syn keyword sqlKeyword	cache compress connect current cursor decimal default desc
21syn keyword sqlKeyword	else elsif end exception exclusive file for from
22syn keyword sqlKeyword	function group having identified if immediate increment
23syn keyword sqlKeyword	index initial initrans into is level link logging loop
24syn keyword sqlKeyword	maxextents maxtrans mode modify monitoring
25syn keyword sqlKeyword	nocache nocompress nologging noparallel nowait of offline on online start
26syn keyword sqlKeyword	parallel successful synonym table tablespace then to trigger uid
27syn keyword sqlKeyword	unique user validate values view whenever
28syn keyword sqlKeyword	where with option order pctfree pctused privileges procedure
29syn keyword sqlKeyword	public resource return row rowlabel rownum rows
30syn keyword sqlKeyword	session share size smallint type using
31
32syn keyword sqlOperator	not and or
33syn keyword sqlOperator	in any some all between exists
34syn keyword sqlOperator	like escape
35syn keyword sqlOperator	union intersect minus
36syn keyword sqlOperator	prior distinct
37syn keyword sqlOperator	sysdate out
38
39syn keyword sqlStatement analyze audit comment commit
40syn keyword sqlStatement delete drop execute explain grant lock noaudit
41syn keyword sqlStatement rename revoke rollback savepoint set
42syn keyword sqlStatement truncate
43" next ones are contained, so folding works.
44syn keyword sqlStatement create update alter select insert contained
45
46syn keyword sqlType	boolean char character date float integer long
47syn keyword sqlType	mlslabel number raw rowid varchar varchar2 varray
48
49" Strings:
50syn region sqlString	start=+"+  skip=+\\\\\|\\"+  end=+"+
51syn region sqlString	start=+'+  skip=+\\\\\|\\'+  end=+'+
52
53" Numbers:
54syn match sqlNumber	"-\=\<\d*\.\=[0-9_]\>"
55
56" Comments:
57syn region sqlComment	start="/\*"  end="\*/" contains=sqlTodo,@Spell fold
58syn match sqlComment	"--.*$" contains=sqlTodo,@Spell
59
60" Setup Folding:
61" this is a hack, to get certain statements folded.
62" the keywords create/update/alter/select/insert need to
63" have contained option.
64syn region sqlFold start='^\s*\zs\c\(Create\|Update\|Alter\|Select\|Insert\)' end=';$\|^$' transparent fold contains=ALL
65
66syn sync ccomment sqlComment
67
68" Functions:
69" (Oracle 11g)
70" Aggregate Functions
71syn keyword sqlFunction	avg collect corr corr_s corr_k count covar_pop covar_samp cume_dist dense_rank first
72syn keyword sqlFunction	group_id grouping grouping_id last max median min percentile_cont percentile_disc percent_rank rank
73syn keyword sqlFunction	regr_slope regr_intercept regr_count regr_r2 regr_avgx regr_avgy regr_sxx regr_syy regr_sxy
74syn keyword sqlFunction	stats_binomial_test stats_crosstab stats_f_test stats_ks_test stats_mode stats_mw_test
75syn keyword sqlFunction	stats_one_way_anova stats_t_test_one stats_t_test_paired stats_t_test_indep stats_t_test_indepu
76syn keyword sqlFunction	stats_wsr_test stddev stddev_pop stddev_samp sum
77syn keyword sqlFunction	sys_xmlagg var_pop var_samp variance xmlagg
78" Char Functions
79syn keyword sqlFunction	ascii chr concat initcap instr length lower lpad ltrim
80syn keyword sqlFunction	nls_initcap nls_lower nlssort nls_upper regexp_instr regexp_replace
81syn keyword sqlFunction	regexp_substr replace rpad rtrim soundex substr translate treat trim upper
82" Comparison Functions
83syn keyword sqlFunction	greatest least
84" Conversion Functions
85syn keyword sqlFunction	asciistr bin_to_num cast chartorowid compose convert
86syn keyword sqlFunction	decompose hextoraw numtodsinterval numtoyminterval rawtohex rawtonhex rowidtochar
87syn keyword sqlFunction	rowidtonchar scn_to_timestamp timestamp_to_scn to_binary_double to_binary_float
88syn keyword sqlFunction	to_char to_char to_char to_clob to_date to_dsinterval to_lob to_multi_byte
89syn keyword sqlFunction	to_nchar to_nchar to_nchar to_nclob to_number to_dsinterval to_single_byte
90syn keyword sqlFunction	to_timestamp to_timestamp_tz to_yminterval to_yminterval translate unistr
91" DataMining Functions
92syn keyword sqlFunction	cluster_id cluster_probability cluster_set feature_id feature_set
93syn keyword sqlFunction	feature_value prediction prediction_bounds prediction_cost
94syn keyword sqlFunction	prediction_details prediction_probability prediction_set
95" Datetime Functions
96syn keyword sqlFunction	add_months current_date current_timestamp dbtimezone extract
97syn keyword sqlFunction	from_tz last_day localtimestamp months_between new_time
98syn keyword sqlFunction	next_day numtodsinterval numtoyminterval round sessiontimezone
99syn keyword sqlFunction	sys_extract_utc sysdate systimestamp to_char to_timestamp
100syn keyword sqlFunction	to_timestamp_tz to_dsinterval to_yminterval trunc tz_offset
101" Numeric Functions
102syn keyword sqlFunction	abs acos asin atan atan2 bitand ceil cos cosh exp
103syn keyword sqlFunction	floor ln log mod nanvl power remainder round sign
104syn keyword sqlFunction	sin sinh sqrt tan tanh trunc width_bucket
105" NLS Functions
106syn keyword sqlFunction	ls_charset_decl_len nls_charset_id nls_charset_name
107" Various Functions
108syn keyword sqlFunction	bfilename cardin coalesce collect decode dump empty_blob empty_clob
109syn keyword sqlFunction	lnnvl nullif nvl nvl2 ora_hash powermultiset powermultiset_by_cardinality
110syn keyword sqlFunction	sys_connect_by_path sys_context sys_guid sys_typeid uid user userenv vsizeality
111" XML Functions
112syn keyword sqlFunction	appendchildxml deletexml depth extract existsnode extractvalue insertchildxml
113syn keyword sqlFunction	insertxmlbefore path sys_dburigen sys_xmlagg sys_xmlgen updatexml xmlagg xmlcast
114syn keyword sqlFunction	xmlcdata xmlcolattval xmlcomment xmlconcat xmldiff xmlelement xmlexists xmlforest
115syn keyword sqlFunction	xmlparse xmlpatch xmlpi xmlquery xmlroot xmlsequence xmlserialize xmltable xmltransform
116" Todo:
117syn keyword sqlTodo TODO FIXME XXX DEBUG NOTE contained
118
119" Define the default highlighting.
120command -nargs=+ HiLink hi def link <args>
121HiLink sqlComment	Comment
122HiLink sqlFunction	Function
123HiLink sqlKeyword	sqlSpecial
124HiLink sqlNumber	Number
125HiLink sqlOperator	sqlStatement
126HiLink sqlSpecial	Special
127HiLink sqlStatement	Statement
128HiLink sqlString	String
129HiLink sqlType		Type
130HiLink sqlTodo		Todo
131
132delcommand HiLink
133let b:current_syntax = "sql"
134" vim: ts=8
135