Mercurial > vim
annotate runtime/syntax/cobol.vim @ 12872:d92adf8c5630
Added tag v8.0.1312 for changeset 1a450ce6980ca7860f24cc6a5bb48343d418781d
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 18 Nov 2017 22:15:06 +0100 |
parents | 46763b01cd9a |
children | bd7461db24b3 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
6647 | 2 " Language: COBOL |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
1125 | 4 " (formerly Davyd Ondrejko <vondraco@columbus.rr.com>) |
7 | 5 " (formerly Sitaram Chamarty <sitaram@diac.com> and |
6647 | 6 " James Mitchell <james_mitchell@acm.org>) |
7 " Last Change: 2015 Feb 13 | |
7 | 8 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
9 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
10 if exists("b:current_syntax") |
7 | 11 finish |
12 endif | |
13 | |
14 " MOST important - else most of the keywords wont work! | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
15 setlocal isk=@,48-57,- |
7 | 16 |
17 syn case ignore | |
18 | |
1125 | 19 syn cluster cobolStart contains=cobolAreaA,cobolAreaB,cobolComment,cobolCompiler |
20 syn cluster cobolAreaA contains=cobolParagraph,cobolSection,cobolDivision | |
21 "syn cluster cobolAreaB contains= | |
22 syn cluster cobolAreaAB contains=cobolLine | |
23 syn cluster cobolLine contains=cobolReserved | |
24 syn match cobolMarker "^\%( \{,5\}[^ ]\)\@=.\{,6}" nextgroup=@cobolStart | |
25 syn match cobolSpace "^ \{6\}" nextgroup=@cobolStart | |
26 syn match cobolAreaA " \{1,4\}" contained nextgroup=@cobolAreaA,@cobolAreaAB | |
27 syn match cobolAreaB " \{5,\}\|- *" contained nextgroup=@cobolAreaB,@cobolAreaAB | |
28 syn match cobolComment "[/*C].*$" contained | |
29 syn match cobolCompiler "$.*$" contained | |
30 syn match cobolLine ".*$" contained contains=cobolReserved,@cobolLine | |
31 | |
32 syn match cobolDivision "[A-Z][A-Z0-9-]*[A-Z0-9]\s\+DIVISION\."he=e-1 contained contains=cobolDivisionName | |
33 syn keyword cobolDivisionName contained IDENTIFICATION ENVIRONMENT DATA PROCEDURE | |
34 syn match cobolSection "[A-Z][A-Z0-9-]*[A-Z0-9]\s\+SECTION\."he=e-1 contained contains=cobolSectionName | |
35 syn keyword cobolSectionName contained CONFIGURATION INPUT-OUTPUT FILE WORKING-STORAGE LOCAL-STORAGE LINKAGE | |
36 syn match cobolParagraph "\a[A-Z0-9-]*[A-Z0-9]\.\|\d[A-Z0-9-]*[A-Z]\."he=e-1 contained contains=cobolParagraphName | |
37 syn keyword cobolParagraphName contained PROGRAM-ID SOURCE-COMPUTER OBJECT-COMPUTER SPECIAL-NAMES FILE-CONTROL I-O-CONTROL | |
38 | |
39 | |
40 "syn match cobolKeys "^\a\{1,6\}" contains=cobolReserved | |
7 | 41 syn keyword cobolReserved contained ACCEPT ACCESS ADD ADDRESS ADVANCING AFTER ALPHABET ALPHABETIC |
42 syn keyword cobolReserved contained ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALS | |
43 syn keyword cobolReserved contained ALTERNATE AND ANY ARE AREA AREAS ASCENDING ASSIGN AT AUTHOR BEFORE BINARY | |
44 syn keyword cobolReserved contained BLANK BLOCK BOTTOM BY CANCEL CBLL CD CF CH CHARACTER CHARACTERS CLASS | |
45 syn keyword cobolReserved contained CLOCK-UNITS CLOSE COBOL CODE CODE-SET COLLATING COLUMN COMMA COMMON | |
1125 | 46 syn keyword cobolReserved contained COMMUNICATIONS COMPUTATIONAL COMPUTE CONTENT CONTINUE |
47 syn keyword cobolReserved contained CONTROL CONVERTING CORR CORRESPONDING COUNT CURRENCY DATE DATE-COMPILED | |
7 | 48 syn keyword cobolReserved contained DATE-WRITTEN DAY DAY-OF-WEEK DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE |
49 syn keyword cobolReserved contained DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING DECIMAL-POINT | |
50 syn keyword cobolReserved contained DELARATIVES DELETE DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION | |
51 syn keyword cobolReserved contained DETAIL DISABLE DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EGI ELSE EMI | |
52 syn keyword cobolReserved contained ENABLE END-ADD END-COMPUTE END-DELETE END-DIVIDE END-EVALUATE END-IF | |
1125 | 53 syn keyword cobolReserved contained END-MULTIPLY END-OF-PAGE END-READ END-RECEIVE END-RETURN |
7 | 54 syn keyword cobolReserved contained END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING |
1125 | 55 syn keyword cobolReserved contained END-WRITE EQUAL ERROR ESI EVALUATE EVERY EXCEPTION EXIT |
56 syn keyword cobolReserved contained EXTEND EXTERNAL FALSE FD FILLER FINAL FIRST FOOTING FOR FROM | |
7 | 57 syn keyword cobolReserved contained GENERATE GIVING GLOBAL GREATER GROUP HEADING HIGH-VALUE HIGH-VALUES I-O |
1125 | 58 syn keyword cobolReserved contained IN INDEX INDEXED INDICATE INITIAL INITIALIZE |
59 syn keyword cobolReserved contained INITIATE INPUT INSPECT INSTALLATION INTO IS JUST | |
7 | 60 syn keyword cobolReserved contained JUSTIFIED KEY LABEL LAST LEADING LEFT LENGTH LOCK MEMORY |
61 syn keyword cobolReserved contained MERGE MESSAGE MODE MODULES MOVE MULTIPLE MULTIPLY NATIVE NEGATIVE NEXT NO NOT | |
1125 | 62 syn keyword cobolReserved contained NUMBER NUMERIC NUMERIC-EDITED OCCURS OF OFF OMITTED ON OPEN |
7 | 63 syn keyword cobolReserved contained OPTIONAL OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW PACKED-DECIMAL PADDING |
64 syn keyword cobolReserved contained PAGE PAGE-COUNTER PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE | |
1125 | 65 syn keyword cobolReserved contained PRINTING PROCEDURES PROCEDD PROGRAM PURGE QUEUE QUOTES |
7 | 66 syn keyword cobolReserved contained RANDOM RD READ RECEIVE RECORD RECORDS REDEFINES REEL REFERENCE REFERENCES |
67 syn keyword cobolReserved contained RELATIVE RELEASE REMAINDER REMOVAL REPLACE REPLACING REPORT REPORTING | |
68 syn keyword cobolReserved contained REPORTS RERUN RESERVE RESET RETURN RETURNING REVERSED REWIND REWRITE RF RH | |
69 syn keyword cobolReserved contained RIGHT ROUNDED RUN SAME SD SEARCH SECTION SECURITY SEGMENT SEGMENT-LIMITED | |
70 syn keyword cobolReserved contained SELECT SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SIGN SIZE SORT | |
1125 | 71 syn keyword cobolReserved contained SORT-MERGE SOURCE STANDARD |
7 | 72 syn keyword cobolReserved contained STANDARD-1 STANDARD-2 START STATUS STOP STRING SUB-QUEUE-1 SUB-QUEUE-2 |
73 syn keyword cobolReserved contained SUB-QUEUE-3 SUBTRACT SUM SUPPRESS SYMBOLIC SYNC SYNCHRONIZED TABLE TALLYING | |
74 syn keyword cobolReserved contained TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TO TOP | |
75 syn keyword cobolReserved contained TRAILING TRUE TYPE UNIT UNSTRING UNTIL UP UPON USAGE USE USING VALUE VALUES | |
1125 | 76 syn keyword cobolReserved contained VARYING WHEN WITH WORDS WRITE |
7 | 77 syn match cobolReserved contained "\<CONTAINS\>" |
78 syn match cobolReserved contained "\<\(IF\|INVALID\|END\|EOP\)\>" | |
79 syn match cobolReserved contained "\<ALL\>" | |
80 | |
1125 | 81 syn cluster cobolLine add=cobolConstant,cobolNumber,cobolPic |
7 | 82 syn keyword cobolConstant SPACE SPACES NULL ZERO ZEROES ZEROS LOW-VALUE LOW-VALUES |
83 | |
1125 | 84 syn match cobolNumber "\<-\=\d*\.\=\d\+\>" contained |
85 syn match cobolPic "\<S*9\+\>" contained | |
86 syn match cobolPic "\<$*\.\=9\+\>" contained | |
87 syn match cobolPic "\<Z*\.\=9\+\>" contained | |
88 syn match cobolPic "\<V9\+\>" contained | |
89 syn match cobolPic "\<9\+V\>" contained | |
90 syn match cobolPic "\<-\+[Z9]\+\>" contained | |
91 syn match cobolTodo "todo" contained containedin=cobolComment | |
7 | 92 |
93 " For MicroFocus or other inline comments, include this line. | |
94 " syn region cobolComment start="*>" end="$" contains=cobolTodo,cobolMarker | |
95 | |
1125 | 96 syn match cobolBadLine "[^ D\*$/-].*" contained |
97 " If comment mark somehow gets into column past Column 7. | |
98 syn match cobolBadLine "\s\+\*.*" contained | |
99 syn cluster cobolStart add=cobolBadLine | |
100 | |
101 | |
7 | 102 syn keyword cobolGoTo GO GOTO |
103 syn keyword cobolCopy COPY | |
104 | |
105 " cobolBAD: things that are BAD NEWS! | |
106 syn keyword cobolBAD ALTER ENTER RENAMES | |
107 | |
1125 | 108 syn cluster cobolLine add=cobolGoTo,cobolCopy,cobolBAD,cobolWatch,cobolEXECs |
109 | |
7 | 110 " cobolWatch: things that are important when trying to understand a program |
111 syn keyword cobolWatch OCCURS DEPENDING VARYING BINARY COMP REDEFINES | |
112 syn keyword cobolWatch REPLACING RUN | |
113 syn match cobolWatch "COMP-[123456XN]" | |
114 | |
115 syn keyword cobolEXECs EXEC END-EXEC | |
116 | |
117 | |
1125 | 118 syn cluster cobolAreaA add=cobolDeclA |
119 syn cluster cobolAreaAB add=cobolDecl | |
120 syn match cobolDeclA "\(0\=1\|77\|78\) " contained nextgroup=cobolLine | |
121 syn match cobolDecl "[1-4]\d " contained nextgroup=cobolLine | |
122 syn match cobolDecl "0\=[2-9] " contained nextgroup=cobolLine | |
123 syn match cobolDecl "66 " contained nextgroup=cobolLine | |
7 | 124 |
1125 | 125 syn match cobolWatch "88 " contained nextgroup=cobolLine |
7 | 126 |
1125 | 127 "syn match cobolBadID "\k\+-\($\|[^-A-Z0-9]\)" contained |
7 | 128 |
1125 | 129 syn cluster cobolLine add=cobolCALLs,cobolString,cobolCondFlow |
130 syn keyword cobolCALLs CALL END-CALL CANCEL GOBACK PERFORM END-PERFORM INVOKE | |
7 | 131 syn match cobolCALLs "EXIT \+PROGRAM" |
132 syn match cobolExtras /\<VALUE \+\d\+\./hs=s+6,he=e-1 | |
133 | |
134 syn match cobolString /"[^"]*\("\|$\)/ | |
135 syn match cobolString /'[^']*\('\|$\)/ | |
136 | |
1125 | 137 "syn region cobolLine start="^.\{6}[ D-]" end="$" contains=ALL |
138 syn match cobolIndicator "\%7c[D-]" contained | |
7 | 139 |
140 if exists("cobol_legacy_code") | |
6647 | 141 syn region cobolCondFlow contains=ALLBUT,cobolLine,cobolBadLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend |
7 | 142 endif |
143 | |
144 " many legacy sources have junk in columns 1-6: must be before others | |
145 " Stuff after column 72 is in error - must be after all other "match" entries | |
146 if exists("cobol_legacy_code") | |
1125 | 147 syn match cobolBadLine "\%73c.*" containedin=ALLBUT,cobolComment |
7 | 148 else |
1125 | 149 syn match cobolBadLine "\%73c.*" containedin=ALL |
7 | 150 endif |
151 | |
152 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
153 " Only when an item doesn't have highlighting yet |
7 | 154 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
155 hi def link cobolBAD Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
156 hi def link cobolBadID Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
157 hi def link cobolBadLine Error |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
158 if exists("g:cobol_legacy_code") |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
159 hi def link cobolMarker Comment |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
160 else |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
161 hi def link cobolMarker Error |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
162 endif |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
163 hi def link cobolCALLs Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
164 hi def link cobolComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
165 hi def link cobolKeys Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
166 hi def link cobolAreaB Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
167 hi def link cobolCompiler PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
168 hi def link cobolCondFlow Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
169 hi def link cobolCopy PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
170 hi def link cobolDeclA cobolDecl |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
171 hi def link cobolDecl Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
172 hi def link cobolExtras Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
173 hi def link cobolGoTo Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
174 hi def link cobolConstant Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
175 hi def link cobolNumber Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
176 hi def link cobolPic Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
177 hi def link cobolReserved Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
178 hi def link cobolDivision Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
179 hi def link cobolSection Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
180 hi def link cobolParagraph Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
181 hi def link cobolDivisionName Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
182 hi def link cobolSectionName Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
183 hi def link cobolParagraphName Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
184 hi def link cobolString Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
185 hi def link cobolTodo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
186 hi def link cobolWatch Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
187 hi def link cobolIndicator Special |
7 | 188 |
189 | |
190 let b:current_syntax = "cobol" | |
191 | |
192 " vim: ts=6 nowrap |