2 " Language: Oracle Procedureal SQL (PL/SQL)
3 " Maintainer: Jeff Lanzarotta (frizbeefanatic@yahoo.com)
4 " URL: http://lanzarotta.tripod.com/vim/syntax/plsql.vim.zip
5 " Last Change: April 30, 2001
7 " For version 5.x, clear all syntax items.
8 " For version 6.x, quit when a syntax file was already loaded.
11 elseif exists("b:current_syntax")
18 syn keyword plsqlTodo TODO FIXME XXX DEBUG NOTE
20 syn match plsqlGarbage "[^ \t()]"
21 syn match plsqlIdentifier "[a-z][a-z0-9$_#]*"
22 syn match plsqlHostIdentifier ":[a-z][a-z0-9$_#]*"
25 syn match plsqlSymbol "\(;\|,\|\.\)"
28 syn match plsqlOperator "\(+\|-\|\*\|/\|=\|<\|>\|@\|\*\*\|!=\|\~=\)"
29 syn match plsqlOperator "\(^=\|<=\|>=\|:=\|=>\|\.\.\|||\|<<\|>>\|\"\)"
32 syn keyword plsqlSQLKeyword ACCESS ADD ALL ALTER AND ANY AS ASC AUDIT
33 syn keyword plsqlSQLKeyword BETWEEN BY CHECK CLUSTER COLUMN COMMENT
34 syn keyword plsqlSQLKeyword COMPRESS CONNECT CREATE CURRENT
35 syn keyword plsqlSQLKeyword DEFAULT DELETE DESC DISTINCT DROP ELSE
36 syn keyword plsqlSQLKeyword EXCLUSIVE EXISTS FILE FROM GRANT
37 syn keyword plsqlSQLKeyword GROUP HAVING IDENTIFIED IMMEDIATE IN INCREMENT
38 syn keyword plsqlSQLKeyword INDEX INITIAL INSERT INTERSECT INTO IS
39 syn keyword plsqlSQLKeyword LEVEL LIKE LOCK MAXEXTENTS MODE NOAUDIT
40 syn keyword plsqlSQLKeyword NOCOMPRESS NOT NOWAIT OF OFFLINE
41 syn keyword plsqlSQLKeyword ON ONLINE OPTION OR ORDER PCTFREE PRIOR
42 syn keyword plsqlSQLKeyword PRIVILEGES PUBLIC RENAME RESOURCE REVOKE
43 syn keyword plsqlSQLKeyword ROW ROWLABEL ROWS SELECT SESSION SET
44 syn keyword plsqlSQLKeyword SHARE START SUCCESSFUL SYNONYM SYSDATE
45 syn keyword plsqlSQLKeyword THEN TO TRIGGER TRUNCATE UID UNION UNIQUE UPDATE
46 syn keyword plsqlSQLKeyword USER VALIDATE VALUES VIEW
47 syn keyword plsqlSQLKeyword WHENEVER WHERE WITH
48 syn keyword plsqlSQLKeyword REPLACE
50 " PL/SQL's own keywords.
51 syn keyword plsqlKeyword ABORT ACCEPT ARRAY ARRAYLEN ASSERT ASSIGN AT
52 syn keyword plsqlKeyword AUTHORIZATION AVG BASE_TABLE BEGIN BODY CASE
53 syn keyword plsqlKeyword CHAR_BASE CLOSE CLUSTERS COLAUTH COMMIT
54 syn keyword plsqlKeyword CONSTANT CRASH CURRVAL DATABASE DATA_BASE DBA
55 syn keyword plsqlKeyword DEBUGOFF DEBUGON DECLARE DEFINTION DELAY
56 syn keyword plsqlKeyword DIGITS DISPOSE DO ENTRY EXCEPTION
57 syn keyword plsqlKeyword EXCEPTION_INIT EXIT FETCH FORM FUNCTION
58 syn keyword plsqlKeyword GENERIC GOTO INDEXES INDICATOR INTERFACE
59 syn keyword plsqlKeyword LIMITED MINUS MISLABEL NATURALN NEW NEXTVAL
60 syn keyword plsqlKeyword NUMBER_BASE OFF OPEN OTHERS OUT PACKAGE PARTITION
61 syn keyword plsqlKeyword PLS_INTEGER POSITIVEN PRAGMA PRIVATE PROCEDURE
62 syn keyword plsqlKeyword RAISE RANGE REF RELEASE REMR RETURN REVERSE
63 syn keyword plsqlKeyword ROLLBACK ROWNUM ROWTYPE RUN SAVEPOINT SCHEMA
64 syn keyword plsqlKeyword SEPERATE SPACE SPOOL SQL SQLCODE SQLERRM STATEMENT
65 syn keyword plsqlKeyword STDDEV SUBTYPE SUM TABAUTH TABLES TASK TERMINATE
66 syn keyword plsqlKeyword TYPE USE VARIABLE VARIANCE VIEWS WHEN WORK WRITE XOR
67 syn match plsqlKeyword "\<END\>"
70 syn keyword plsqlFunction ABS ACOS ADD_MONTH ASCII ASIN ATAN ATAN2 AVG CEIL
71 syn keyword plsqlFunction CHARTOROWID CHR CONCAT CONVERT COS COSH COUNT DECODE
72 syn keyword plsqlFunction EXP FLOOR GREATEST HEXTORAW INITCAP INSTR INSTRB
73 syn keyword plsqlFunction LAST_DAY LEAST LENGTH LENGTHB LN LOG LOWER LPAD
74 syn keyword plsqlFunction LTRIM MAX MIN MOD MONTHS_BETWEEN NEW_TIME NEX_DAY
75 syn keyword plsqlFunction NLS_INITCAP NLS_LOWER NLS_UPPER NLSSORT NVL POWER
76 syn keyword plsqlFunction RAWTOHEX REPLACE ROUND ROUND ROWIDTOCHAR RPAD RTRIM
77 syn keyword plsqlFunction SIGN SIN SINH SOUNDEX SQRT STDDEV SUBSTR SUBSTRB SUM
78 syn keyword plsqlFunction SYSDATE TAN TANH TO_CHAR TO_DATE TO_NUMBER TRANSLATE
79 syn keyword plsqlFunction TRUNC TRUNC UID UPPER USER USERENV VARIANCE VSIZE
81 " Oracle Pseudo Colums.
82 syn keyword plsqlPseudo CURRVAL LEVEL NEXTVAL ROWID ROWNUM
84 if exists("plsql_highlight_triggers")
85 syn keyword plsqlTrigger INSERTING UPDATING DELETING
89 syn keyword plsqlConditional ELSIF ELSE IF
90 syn match plsqlConditional "\<END\s\+IF\>"
93 syn keyword plsqlRepeat FOR LOOP WHILE
94 syn match plsqlRepeat "\<END\s\+LOOP\>"
96 " Various types of comments.
97 syn match plsqlComment "--.*$" contains=plsqlTodo
98 syn region plsqlComment start="/\*" end="\*/" contains=plsqlTodo
99 syn sync ccomment plsqlComment
101 " To catch unterminated string literals.
102 syn match plsqlStringError "'.*$"
104 " Various types of literals.
105 syn match plsqlIntLiteral "[+-]\=[0-9]\+"
106 syn match plsqlFloatLiteral "[+-]\=\([0-9]*\.[0-9]\+\|[0-9]\+\.[0-9]\+\)\(e[+-]\=[0-9]\+\)\="
107 syn match plsqlCharLiteral "'[^']'"
108 syn match plsqlStringLiteral "'\([^']\|''\)*'"
109 syn keyword plsqlBooleanLiteral TRUE FALSE NULL
111 " The built-in types.
112 syn keyword plsqlStorage BINARY_INTEGER BOOLEAN CHAR CURSOR DATE DECIMAL
113 syn keyword plsqlStorage FLOAT INTEGER LONG MLSLABEL NATURAL NUMBER
114 syn keyword plsqlStorage POSITIVE RAW REAL RECORD ROWID SMALLINT TABLE
115 syn keyword plsqlStorage VARCHAR VARCHAR2
117 " A type-attribute is really a type.
118 syn match plsqlTypeAttribute ":\=[a-z][a-z0-9$_#]*%\(TYPE\|ROWTYPE\)\>"
120 " All other attributes.
121 syn match plsqlAttribute "%\(NOTFOUND\|ROWCOUNT\|FOUND\|ISOPEN\)\>"
123 " This'll catch mis-matched close-parens.
124 syn region plsqlParen transparent start='(' end=')' contains=ALLBUT,plsqlParenError
125 syn match plsqlParenError ")"
127 " Syntax Synchronizing
128 syn sync minlines=10 maxlines=100
130 " Define the default highlighting.
131 " For version 5.x and earlier, only when not done already.
132 " For version 5.8 and later, only when and item doesn't have highlighting yet.
133 if version >= 508 || !exists("did_plsql_syn_inits")
135 let did_plsql_syn_inits = 1
136 command -nargs=+ HiLink hi link <args>
138 command -nargs=+ HiLink hi def link <args>
141 HiLink plsqlAttribute Macro
142 HiLink plsqlBooleanLiteral Boolean
143 HiLink plsqlCharLiteral Character
144 HiLink plsqlComment Comment
145 HiLink plsqlConditional Conditional
146 HiLink plsqlFloatLiteral Float
147 HiLink plsqlFunction Function
148 HiLink plsqlGarbage Error
149 HiLink plsqlHostIdentifier Label
150 HiLink plsqlIdentifier Normal
151 HiLink plsqlIntLiteral Number
152 HiLink plsqlOperator Operator
153 HiLink plsqlParen Normal
154 HiLink plsqlParenError Error
155 HiLink plsqlPseudo PreProc
156 HiLink plsqlKeyword Keyword
157 HiLink plsqlRepeat Repeat
158 HiLink plsqlStorage StorageClass
159 HiLink plsqlSQLKeyword Statement
160 HiLink plsqlStringError Error
161 HiLink plsqlStringLiteral String
162 HiLink plsqlSymbol Normal
163 HiLink plsqlTrigger Function
164 HiLink plsqlTypeAttribute StorageClass
165 HiLink plsqlTodo Todo
170 let b:current_syntax = "plsql"