5239
|
1 " Vim syntax file
|
|
2 " Modified from http://plnet.org/files/vim/
|
|
3 " using keywords from http://www.kednos.com/pli/docs/reference_manual/6291pro_contents.html
|
|
4 " 2012-11-13 Alan Thompson
|
|
5
|
|
6 if version < 600
|
|
7 syntax clear
|
|
8 elseif exists("b:current_syntax")
|
|
9 finish
|
|
10 endif
|
|
11
|
|
12 syn case ignore
|
|
13
|
|
14 " Todo.
|
|
15 syn keyword pl1Todo TODO FIXME XXX DEBUG NOTE
|
|
16
|
|
17 " pl1CommentGroup allows adding matches for special things in comments
|
|
18 " 20010723az: Added this so that these could be matched in comments...
|
|
19 syn cluster pl1CommentGroup contains=pl1Todo
|
|
20
|
|
21 syn match pl1Garbage "[^ \t()]"
|
|
22 syn match pl1Identifier "[a-z][a-z0-9$_#]*"
|
|
23 syn match pl1HostIdentifier ":[a-z][a-z0-9$_#]*"
|
|
24
|
|
25 " 20010723az: When wanted, highlight the trailing whitespace -- this is
|
|
26 " based on c_space_errors
|
|
27 if exists("c_space_errors")
|
|
28 if !exists("c_no_trail_space_error")
|
|
29 syn match pl1SpaceError "\s\+$"
|
|
30 endif
|
|
31 if !exists("c_no_tab_space_error")
|
|
32 syn match pl1SpaceError " \+\t"me=e-1
|
|
33 endif
|
|
34 endif
|
|
35
|
|
36 " Symbols.
|
|
37 syn match pl1Symbol "\(;\|,\|\.\)"
|
|
38 syn match pl1PreProcSym "%"
|
|
39
|
|
40 " Operators.
|
|
41 syn match pl1Operator "\(&\|:\|!\|+\|-\|\*\|/\|=\|<\|>\|@\|\*\*\|!=\|\~=\)"
|
|
42 syn match pl1Operator "\(\^\|\^=\|<=\|>=\|:=\|=>\|\.\.\|||\|<<\|>>\|\"\)"
|
|
43
|
|
44 " Attributes
|
|
45 syn keyword pl1Attribute BACKWARDS BUFFERED BUF CONNECTED CONN CONSTANT EVENT
|
|
46 syn keyword pl1Attribute EXCLUSIVE EXCL FORMAT GENERIC IRREDUCIBLE IRRED LOCAL
|
|
47 syn keyword pl1Attribute REDUCIBLE RED TASK TRANSIENT UNBUFFERED UNBUF ALIGNED ANY
|
|
48 syn keyword pl1Attribute AREA AUTOMATIC AUTO BASED BUILTIN CONDITION COND CONTROLLED
|
|
49 syn keyword pl1Attribute CTL DEFINED DEF DIRECT ENVIRONMENT ENV EXTERNAL EXT FILE
|
|
50 syn keyword pl1Attribute GLOBALDEF GLOBALREF INITIAL INIT INPUT INTERNAL INT KEYED
|
|
51 syn keyword pl1Attribute LABEL LIKE LIST MEMBER NONVARYING NONVAR OPTIONAL OPTIONS
|
|
52 syn keyword pl1Attribute OUTPUT PARAMETER PARM PICTURE PIC POSITION POS PRECISION
|
|
53 syn keyword pl1Attribute PREC PRINT READONLY RECORD REFER RETURNS SEQUENTIAL SEQL
|
|
54 syn keyword pl1Attribute STATIC STREAM STRUCTURE TRUNCATE UNALIGNED UNAL UNION UPDATE
|
|
55 syn keyword pl1Attribute VARIABLE VARYING VAR COMPLEX CPLX REAL BINARY BIN BIT
|
|
56 syn keyword pl1Attribute CHARACTER CHAR DECIMAL DEC DESCRIPTOR DESC DIMENSION DIM
|
|
57 syn keyword pl1Attribute FIXED FLOAT OFFSET POINTER PTR REFERENCE VALUE VAL
|
|
58
|
|
59 " Functions
|
|
60 syn keyword pl1Function AFTER ALL ANY BEFORE COMPLETION CPLN CONJG COUNT
|
|
61 syn keyword pl1Function CURRENTSTORAGE CSTG DATAFIELD DECAT DOT ERF ERFC IMAG
|
|
62 syn keyword pl1Function ONCOUNT ONFIELD ONLOC POLY PRIORITY REPEAT SAMEKEY STATUS
|
|
63 syn keyword pl1Function STORAGE STG ABS ACOS ACTUALCOUNT ADD ADDR ADDREL ALLOCATION
|
|
64 syn keyword pl1Function ALLOCN ASIN ATAN ATAND ATANH BOOL BYTE BYTESIZE CEIL COLLATE
|
|
65 syn keyword pl1Function COPY COS COSD COSH DATE DATETIME DECODE DISPLAY DIVIDE EMPTY
|
|
66 syn keyword pl1Function ENCODE ERROR EVERY EXP EXTEND FLOOR FLUSH FREE HBOUND HIGH
|
|
67 syn keyword pl1Function INDEX INFORM INT LBOUND LENGTH LINE LINENO LOG LOG10 LOG2
|
|
68 syn keyword pl1Function LOW LTRIM MAX MAXLENGTH MIN MOD MULTIPLY NEXT_VOLUME NULL
|
|
69 syn keyword pl1Function ONARGSLIST ONCHAR ONCODE ONFILE ONKEY ONSOURCE PAGENO POSINT
|
|
70 syn keyword pl1Function PRESENT PROD RANK RELEASE RESIGNAL REVERSE REWIND ROUND
|
|
71 syn keyword pl1Function RTRIM SEARCH SIGN SIN SIND SINH SIZE SOME SPACEBLOCK SQRT
|
|
72 syn keyword pl1Function STRING SUBSTR SUBTRACT SUM TAN TAND TANH TIME TRANSLATE TRIM
|
|
73 syn keyword pl1Function TRUNC UNSPEC VALID VARIANT VERIFY WARN
|
|
74
|
|
75 " Other keywords
|
|
76 syn keyword pl1Other ATTENTION ATTN C CONVERSION CONV DATA NAME NOCONVERSION
|
|
77 syn keyword pl1Other NOCONV NOFIXEDOVERFLOW NOFOFL NOOVERFLOW NOSIZE
|
|
78 syn keyword pl1Other NOSTRINGRANGE NOSTRG NOSTRINGSIZE NOSTRZ NOSUBSCRIPTRANGE
|
|
79 syn keyword pl1Other NOSUBRG NOZERODIVIDE NOZDIV OVERFLOW OFL PENDING RECORD
|
|
80 syn keyword pl1Other REENTRANT SIZE STRINGRANGE STRG STRINGSIZE STRZ
|
|
81 syn keyword pl1Other SUBSCRIPTRANGE SUBRG TRANSMIT A ANYCONDITION APPEND B B1 B2
|
|
82 syn keyword pl1Other B3 B4 BACKUP_DATE BATCH BLOCK_BOUNDARY_FORMAT BLOCK_IO
|
|
83 syn keyword pl1Other BLOCK_SIZE BUCKET_SIZE BY CANCEL_CONTROL_O
|
|
84 syn keyword pl1Other CARRIAGE_RETURN_FORMAT COLUMN COL CONTIGUOUS
|
|
85 syn keyword pl1Other CONTIGUOUS_BEST_TRY CONVERSION CONV CREATION_DATE
|
|
86 syn keyword pl1Other CURRENT_POSITION DEFAULT_FILE_NAME DEFERRED_WRITE E EDIT
|
|
87 syn keyword pl1Other ENDFILE ENDPAGE EXPIRATION_DATE EXTENSION_SIZE F FAST_DELETE
|
|
88 syn keyword pl1Other FILE_ID FILE_ID_TO FILE_SIZE FINISH FIXEDOVERFLOW FOFL
|
|
89 syn keyword pl1Other FIXED_CONTROL_FROM FIXED_CONTROL_SIZE FIXED_CONTROL_SIZE_TO
|
|
90 syn keyword pl1Other FIXED_CONTROL_TO FIXED_LENGTH_RECORDS FROM GROUP_PROTECTION
|
|
91 syn keyword pl1Other IDENT IGNORE_LINE_MARKS IN INDEXED INDEX_NUMBER INITIAL_FILL
|
|
92 syn keyword pl1Other INTO KEY KEYFROM KEYTO LINESIZE LOCK_ON_READ LOCK_ON_WRITE
|
|
93 syn keyword pl1Other MAIN MANUAL_UNLOCKING MATCH_GREATER MATCH_GREATER_EQUAL
|
|
94 syn keyword pl1Other MATCH_NEXT MATCH_NEXT_EQUAL MAXIMUM_RECORD_NUMBER
|
|
95 syn keyword pl1Other MAXIMUM_RECORD_SIZE MULTIBLOCK_COUNT MULTIBUFFER_COUNT
|
|
96 syn keyword pl1Other NOLOCK NONEXISTENT_RECORD NONRECURSIVE NO_ECHO NO_FILTER
|
|
97 syn keyword pl1Other NO_SHARE OVERFLOW OFL OWNER_GROUP OWNER_ID OWNER_MEMBER
|
|
98 syn keyword pl1Other OWNER_PROTECTION P PAGE PAGESIZE PRINTER_FORMAT PROMPT
|
|
99 syn keyword pl1Other PURGE_TYPE_AHEAD R READ_AHEAD READ_CHECK READ_REGARDLESS
|
|
100 syn keyword pl1Other RECORD_ID RECORD_ID_ACCESS RECORD_ID_TO RECURSIVE REPEAT
|
|
101 syn keyword pl1Other RETRIEVAL_POINTERS REVISION_DATE REWIND_ON_CLOSE
|
|
102 syn keyword pl1Other REWIND_ON_OPEN SCALARVARYING SET SHARED_READ SHARED_WRITE
|
|
103 syn keyword pl1Other SKIP SPOOL STORAGE STRINGRANGE STRG SUBSCRIPTRANGE SUBRG
|
|
104 syn keyword pl1Other SUPERSEDE SYSIN SYSPRINT SYSTEM_PROTECTION TAB TEMPORARY
|
|
105 syn keyword pl1Other TIMEOUT_PERIOD TITLE TO UNDEFINEDFILE UNDF UNDERFLOW UFL
|
|
106 syn keyword pl1Other UNTIL USER_OPEN VAXCONDITION WAIT_FOR_RECORD WHILE
|
|
107 syn keyword pl1Other WORLD_PROTECTION WRITE_BEHIND WRITE_CHECK X ZERODIVIDE ZDIV
|
|
108
|
|
109 " PreProcessor keywords
|
|
110 syn keyword pl1PreProc ACTIVATE DEACTIVATE DECLARE DCL DICTIONARY DO END ERROR
|
|
111 syn keyword pl1PreProc FATAL GOTO IF INCLUDE INFORM LIST NOLIST PAGE PROCEDURE PROC
|
|
112 syn keyword pl1PreProc REPLACE RETURN SBTTL TITLE WARN THEN ELSE
|
|
113
|
|
114 " Statements
|
|
115 syn keyword pl1Statement CALL SUB ENTRY BY NAME CASE CHECK COPY DEFAULT DFT DELAY
|
|
116 syn keyword pl1Statement DESCRIPTORS DISPLAY EXIT FETCH HALT IGNORE LIST LOCATE
|
|
117 syn keyword pl1Statement NOCHECK NOLOCK NONE ORDER RANGE RELEASE REORDER REPLY SNAP
|
|
118 syn keyword pl1Statement SYSTEM TAB UNLOCK WAIT ALLOCATE ALLOC BEGIN CALL CLOSE
|
|
119 syn keyword pl1Statement DECLARE DCL DELETE DO ELSE END FORMAT GET GOTO GO TO IF
|
|
120 syn keyword pl1Statement LEAVE NORESCAN ON OPEN OTHERWISE OTHER PROCEDURE PROC PUT
|
|
121 syn keyword pl1Statement READ RESCAN RETURN REVERT REWRITE SELECT SIGNAL SNAP
|
|
122 syn keyword pl1Statement STATEMENT STOP SYSTEM THEN WHEN WRITE
|
|
123
|
|
124 " PL1's own keywords
|
|
125 " syn match pl1Keyword "\<END\>"
|
|
126 " syn match pl1Keyword "\.COUNT\>"hs=s+1
|
|
127 " syn match pl1Keyword "\.EXISTS\>"hs=s+1
|
|
128 " syn match pl1Keyword "\.FIRST\>"hs=s+1
|
|
129 " syn match pl1Keyword "\.LAST\>"hs=s+1
|
|
130 " syn match pl1Keyword "\.DELETE\>"hs=s+1
|
|
131 " syn match pl1Keyword "\.PREV\>"hs=s+1
|
|
132 " syn match pl1Keyword "\.NEXT\>"hs=s+1
|
|
133
|
|
134 if exists("pl1_highlight_triggers")
|
|
135 syn keyword pl1Trigger INSERTING UPDATING DELETING
|
|
136 endif
|
|
137
|
|
138 " Conditionals.
|
|
139 syn keyword pl1Conditional ELSIF ELSE IF
|
|
140 syn match pl1Conditional "\<END\s\+IF\>"
|
|
141
|
|
142 " Loops.
|
|
143 syn keyword pl1Repeat FOR LOOP WHILE FORALL
|
|
144 syn match pl1Repeat "\<END\s\+LOOP\>"
|
|
145
|
|
146 " Various types of comments.
|
|
147 " 20010723az: Added the ability to treat strings within comments just like
|
|
148 " C does.
|
|
149 if exists("c_comment_strings")
|
|
150 syntax match pl1CommentSkip contained "^\s*\*\($\|\s\+\)"
|
|
151 syntax region pl1CommentString contained start=+L\="+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=pl1CommentSkip
|
|
152 syntax region pl1Comment2String contained start=+L\="+ skip=+\\\\\|\\"+ end=+"+ end="$"
|
|
153 syntax region pl1CommentL start="--" skip="\\$" end="$" keepend contains=@pl1CommentGroup,pl1Comment2String,pl1CharLiteral,pl1BooleanLiteral,pl1NumbersCom,pl1SpaceError
|
|
154 syntax region pl1Comment start="/\*" end="\*/" contains=@pl1CommentGroup,pl1Comment2String,pl1CharLiteral,pl1BooleanLiteral,pl1NumbersCom,pl1SpaceError
|
|
155 else
|
|
156 syntax region pl1CommentL start="--" skip="\\$" end="$" keepend contains=@pl1CommentGroup,pl1SpaceError
|
|
157 syntax region pl1Comment start="/\*" end="\*/" contains=@pl1CommentGroup,pl1SpaceError
|
|
158 endif
|
|
159
|
|
160 " 20010723az: These are the old comment commands ... commented out.
|
|
161 " syn match pl1Comment "--.*$" contains=pl1Todo
|
|
162 " syn region pl1Comment start="/\*" end="\*/" contains=pl1Todo
|
|
163 syn sync ccomment pl1Comment
|
|
164 syn sync ccomment pl1CommentL
|
|
165
|
|
166 " To catch unterminated string literals.
|
|
167 syn match pl1StringError "'.*$"
|
|
168
|
|
169 " Various types of literals.
|
|
170 " 20010723az: Added stuff for comment matching.
|
|
171 syn match pl1Numbers transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=pl1IntLiteral,pl1FloatLiteral
|
|
172 syn match pl1NumbersCom contained transparent "\<[+-]\=\d\|[+-]\=\.\d" contains=pl1IntLiteral,pl1FloatLiteral
|
|
173 syn match pl1IntLiteral contained "[+-]\=\d\+"
|
|
174 syn match pl1FloatLiteral contained "[+-]\=\d\+\.\d*"
|
|
175 syn match pl1FloatLiteral contained "[+-]\=\d*\.\d*"
|
|
176 "syn match pl1FloatLiteral "[+-]\=\([0-9]*\.[0-9]\+\|[0-9]\+\.[0-9]\+\)\(e[+-]\=[0-9]\+\)\="
|
|
177 syn match pl1CharLiteral "'[^']'"
|
|
178 syn match pl1StringLiteral "'\([^']\|''\)*'"
|
|
179 syn keyword pl1BooleanLiteral TRUE FALSE NULL
|
|
180
|
|
181 " The built-in types.
|
|
182 syn keyword pl1Storage ANYDATA ANYTYPE BFILE BINARY_INTEGER BLOB BOOLEAN
|
|
183 syn keyword pl1Storage BYTE CHAR CHARACTER CLOB CURSOR DATE DAY DEC DECIMAL
|
|
184 syn keyword pl1Storage DOUBLE DSINTERVAL_UNCONSTRAINED FLOAT HOUR
|
|
185 syn keyword pl1Storage INT INTEGER INTERVAL LOB LONG MINUTE
|
|
186 syn keyword pl1Storage MLSLABEL MONTH NATURAL NATURALN NCHAR NCHAR_CS NCLOB
|
|
187 syn keyword pl1Storage NUMBER NUMERIC NVARCHAR PLS_INT PLS_INTEGER
|
|
188 syn keyword pl1Storage POSITIVE POSITIVEN PRECISION RAW REAL RECORD
|
|
189 syn keyword pl1Storage SECOND SIGNTYPE SMALLINT STRING SYS_REFCURSOR TABLE TIME
|
|
190 syn keyword pl1Storage TIMESTAMP TIMESTAMP_UNCONSTRAINED
|
|
191 syn keyword pl1Storage TIMESTAMP_TZ_UNCONSTRAINED
|
|
192 syn keyword pl1Storage TIMESTAMP_LTZ_UNCONSTRAINED UROWID VARCHAR
|
|
193 syn keyword pl1Storage VARCHAR2 YEAR YMINTERVAL_UNCONSTRAINED ZONE
|
|
194
|
|
195 " A type-attribute is really a type.
|
|
196 " 20020916bp: Removed leading part of pattern to avoid highlighting the
|
|
197 " object
|
|
198 syn match pl1TypeAttribute "%\(TYPE\|ROWTYPE\)\>"
|
|
199
|
|
200 " All other attributes.
|
|
201 syn match pl1Attribute "%\(BULK_EXCEPTIONS\|BULK_ROWCOUNT\|ISOPEN\|FOUND\|NOTFOUND\|ROWCOUNT\)\>"
|
|
202
|
|
203 " Catch errors caused by wrong parentheses and brackets
|
|
204 " 20010723az: significantly more powerful than the values -- commented out
|
|
205 " below the replaced values. This adds the C functionality to PL/SQL.
|
|
206 syn cluster pl1ParenGroup contains=pl1ParenError,@pl1CommentGroup,pl1CommentSkip,pl1IntLiteral,pl1FloatLiteral,pl1NumbersCom
|
|
207 if exists("c_no_bracket_error")
|
|
208 syn region pl1Paren transparent start='(' end=')' contains=ALLBUT,@pl1ParenGroup
|
|
209 syn match pl1ParenError ")"
|
|
210 syn match pl1ErrInParen contained "[{}]"
|
|
211 else
|
|
212 syn region pl1Paren transparent start='(' end=')' contains=ALLBUT,@pl1ParenGroup,pl1ErrInBracket
|
|
213 syn match pl1ParenError "[\])]"
|
|
214 syn match pl1ErrInParen contained "[{}]"
|
|
215 syn region pl1Bracket transparent start='\[' end=']' contains=ALLBUT,@pl1ParenGroup,pl1ErrInParen
|
|
216 syn match pl1ErrInBracket contained "[);{}]"
|
|
217 endif
|
|
218 " syn region pl1Paren transparent start='(' end=')' contains=ALLBUT,pl1ParenError
|
|
219 " syn match pl1ParenError ")"
|
|
220
|
|
221 " Syntax Synchronizing
|
|
222 syn sync minlines=10 maxlines=100
|
|
223
|
|
224 " Define the default highlighting.
|
|
225 " For version 5.x and earlier, only when not done already.
|
|
226 " For version 5.8 and later, only when and item doesn't have highlighting
|
|
227 " yet.
|
|
228 if version >= 508 || !exists("did_pl1_syn_inits")
|
|
229 if version < 508
|
|
230 let did_pl1_syn_inits = 1
|
|
231 command -nargs=+ HiLink hi link <args>
|
|
232 else
|
|
233 command -nargs=+ HiLink hi def link <args>
|
|
234 endif
|
|
235
|
|
236 HiLink pl1Attribute Macro
|
|
237 HiLink pl1BlockError Error
|
|
238 HiLink pl1BooleanLiteral Boolean
|
|
239 HiLink pl1CharLiteral Character
|
|
240 HiLink pl1Comment Comment
|
|
241 HiLink pl1CommentL Comment
|
|
242 HiLink pl1Conditional Conditional
|
|
243 HiLink pl1Error Error
|
|
244 HiLink pl1ErrInBracket Error
|
|
245 HiLink pl1ErrInBlock Error
|
|
246 HiLink pl1ErrInParen Error
|
|
247 HiLink pl1Exception Function
|
|
248 HiLink pl1FloatLiteral Float
|
|
249 HiLink pl1Function Function
|
|
250 HiLink pl1Garbage Error
|
|
251 HiLink pl1HostIdentifier Label
|
|
252 HiLink pl1Identifier Normal
|
|
253 HiLink pl1IntLiteral Number
|
|
254 HiLink pl1Operator Operator
|
|
255 HiLink pl1Paren Normal
|
|
256 HiLink pl1ParenError Error
|
|
257 HiLink pl1SpaceError Error
|
|
258 HiLink pl1Pseudo PreProc
|
|
259 HiLink pl1PreProc PreProc
|
|
260 HiLink pl1PreProcSym PreProc
|
|
261 HiLink pl1Keyword Keyword
|
|
262 HiLink pl1Other Keyword
|
|
263 HiLink pl1Repeat Repeat
|
|
264 HiLink pl1Statement Keyword
|
|
265 HiLink pl1Storage StorageClass
|
|
266 HiLink pl1StringError Error
|
|
267 HiLink pl1StringLiteral String
|
|
268 HiLink pl1CommentString String
|
|
269 HiLink pl1Comment2String String
|
|
270 HiLink pl1Symbol Normal
|
|
271 HiLink pl1Trigger Function
|
|
272 HiLink pl1TypeAttribute StorageClass
|
|
273 HiLink pl1Todo Todo
|
|
274
|
|
275 delcommand HiLink
|
|
276 endif
|
|
277
|
|
278 let b:current_syntax = "pl1"
|