Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
cobol.vim261 linesDownload Raw Back to syntax
1" Vim syntax file2" Language:     COBOL3" Maintainer: Ankit Jain <ajatkj@yahoo.co.in>4"     (formerly Tim Pope <vimNOSPAM@tpope.info>)5"     (formerly Davyd Ondrejko <vondraco@columbus.rr.com>)6"     (formerly Sitaram Chamarty <sitaram@diac.com> and7"               James Mitchell <james_mitchell@acm.org>)8" Last Change:    2019 Mar 229" Ankit Jain      22.03.2019     Changes & fixes:10"                                1. Include inline comments11"                                2. Use comment highlight for bad lines12"                                3. Change certain 'keywords' to 'matches' 13"                                for additional highlighting14"                                4. Different highlighting for COPY, GO TO &15"                                CALL lines16"                                5. Fix for COMP keyword17"                                6. Fix for PROCEDURE DIVISION highlighting18"                                7. Highlight EXIT PROGRAM like STOP RUN19"                                8. Highlight X & A in PIC clause20"                                Tag: #C2203201921 22" quit when a syntax file was already loaded23if exists("b:current_syntax")24  finish25endif26 27" MOST important - else most of the keywords wont work!28setlocal isk=@,48-57,-,_29 30if !exists('g:cobol_inline_comment')31   let g:cobol_inline_comment=032endif33 34syn case ignore35 36syn cluster cobolStart      contains=cobolAreaA,cobolAreaB,cobolComment,cobolCompiler37syn cluster cobolAreaA      contains=cobolParagraph,cobolSection,cobolDivision38"syn cluster cobolAreaB      contains=39syn cluster cobolAreaAB     contains=cobolLine40syn cluster cobolLine       contains=cobolReserved41syn match   cobolMarker     "^\%( \{,5\}[^ ]\)\@=.\{,6}" nextgroup=@cobolStart42syn match   cobolSpace      "^ \{6\}"  nextgroup=@cobolStart43syn match   cobolAreaA      " \{1,4\}"  contained nextgroup=@cobolAreaA,@cobolAreaAB44syn match   cobolAreaB      " \{5,\}\|- *" contained nextgroup=@cobolAreaB,@cobolAreaAB45syn match   cobolComment    "[/*C].*$" contained46syn match   cobolCompiler   "$.*$"     contained47syn match   cobolLine       ".*$"      contained contains=cobolReserved,@cobolLine48 49"#C22032019: Fix for PROCEDURE DIVISION USING highlighting, removed . from the50"end of the regex51"syn match   cobolDivision       \"[A-Z][A-Z0-9-]*[A-Z0-9]\s\+DIVISION\."he=e-1 contained contains=cobolDivisionName52syn match   cobolDivision       "[A-Z][A-Z0-9-]*[A-Z0-9]\s\+DIVISION" contained contains=cobolDivisionName53syn keyword cobolDivisionName   contained IDENTIFICATION ENVIRONMENT DATA PROCEDURE54syn match   cobolSection        "[A-Z][A-Z0-9-]*[A-Z0-9]\s\+SECTION\."he=e-1  contained contains=cobolSectionName55syn keyword cobolSectionName    contained CONFIGURATION INPUT-OUTPUT FILE WORKING-STORAGE LOCAL-STORAGE LINKAGE56syn match   cobolParagraph      "\a[A-Z0-9-]*[A-Z0-9]\.\|\d[A-Z0-9-]*[A-Z]\."he=e-1             contained contains=cobolParagraphName57syn keyword cobolParagraphName  contained PROGRAM-ID SOURCE-COMPUTER OBJECT-COMPUTER SPECIAL-NAMES FILE-CONTROL I-O-CONTROL58 59 60"syn match cobolKeys "^\a\{1,6\}" contains=cobolReserved61"#C22032019: Remove BY, REPLACING, PROGRAM, TO, IN from 'keyword' group and add62"to 'match' group or other 'keyword' group63syn keyword cobolReserved contained ACCEPT ACCESS ADD ADDRESS ADVANCING AFTER ALPHABET ALPHABETIC64syn keyword cobolReserved contained ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALS65syn keyword cobolReserved contained ALTERNATE AND ANY ARE AREA AREAS ASCENDING ASSIGN AT AUTHOR BEFORE BINARY66syn keyword cobolReserved contained BLANK BLOCK BOTTOM CANCEL CBLL CD CF CH CHARACTER CHARACTERS CLASS67syn keyword cobolReserved contained CLOCK-UNITS CLOSE COBOL CODE CODE-SET COLLATING COLUMN COMMA COMMON68syn keyword cobolReserved contained COMMUNICATIONS COMPUTATIONAL COMPUTE CONTENT CONTINUE69syn keyword cobolReserved contained CONTROL CONVERTING CORR CORRESPONDING COUNT CURRENCY DATE DATE-COMPILED70syn keyword cobolReserved contained DATE-WRITTEN DAY DAY-OF-WEEK DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE71syn keyword cobolReserved contained DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING DECIMAL-POINT72syn keyword cobolReserved contained DELARATIVES DELETE DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION73syn keyword cobolReserved contained DETAIL DISABLE DISPLAY DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EGI ELSE EMI74syn keyword cobolReserved contained ENABLE END-ADD END-COMPUTE END-DELETE END-DIVIDE END-EVALUATE END-IF75syn keyword cobolReserved contained END-MULTIPLY END-OF-PAGE END-READ END-RECEIVE END-RETURN76syn keyword cobolReserved contained END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING77syn keyword cobolReserved contained END-WRITE EQUAL ERROR ESI EVALUATE EVERY EXCEPTION EXIT78syn keyword cobolReserved contained EXTEND EXTERNAL FALSE FD FILLER FINAL FIRST FOOTING FOR FROM79syn keyword cobolReserved contained GENERATE GIVING GLOBAL GREATER GROUP HEADING HIGH-VALUE HIGH-VALUES I-O80syn keyword cobolReserved contained INDEX INDEXED INDICATE INITIAL INITIALIZE81syn keyword cobolReserved contained INITIATE INPUT INSPECT INSTALLATION INTO IS JUST82syn keyword cobolReserved contained JUSTIFIED KEY LABEL LAST LEADING LEFT LENGTH LOCK MEMORY83syn keyword cobolReserved contained MERGE MESSAGE MODE MODULES MOVE MULTIPLE MULTIPLY NATIVE NEGATIVE NEXT NO NOT84syn keyword cobolReserved contained NUMBER NUMERIC NUMERIC-EDITED OCCURS OF OFF OMITTED ON OPEN85syn keyword cobolReserved contained OPTIONAL OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW PACKED-DECIMAL PADDING86syn keyword cobolReserved contained PAGE PAGE-COUNTER PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE87syn keyword cobolReserved contained PRINTING PROCEDURES PROCEDD PURGE QUEUE QUOTES88syn keyword cobolReserved contained RANDOM RD READ RECEIVE RECORD RECORDS REDEFINES REEL REFERENCE REFERENCES89syn keyword cobolReserved contained RELATIVE RELEASE REMAINDER REMOVAL REPLACE REPORT REPORTING90syn keyword cobolReserved contained REPORTS RERUN RESERVE RESET RETURN RETURNING REVERSED REWIND REWRITE RF RH91syn keyword cobolReserved contained RIGHT ROUNDED RUN SAME SD SEARCH SECTION SECURITY SEGMENT SEGMENT-LIMITED92syn keyword cobolReserved contained SELECT SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SIGN SIZE SORT93syn keyword cobolReserved contained SORT-MERGE SOURCE STANDARD94syn keyword cobolReserved contained STANDARD-1 STANDARD-2 START STATUS STOP STRING SUB-QUEUE-1 SUB-QUEUE-295syn keyword cobolReserved contained SUB-QUEUE-3 SUBTRACT SUM SUPPRESS SYMBOLIC SYNC SYNCHRONIZED TABLE TALLYING96syn keyword cobolReserved contained TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TOP97syn keyword cobolReserved contained TRAILING TRUE TYPE UNIT UNSTRING UNTIL UP UPON USAGE USE USING VALUE VALUES98syn keyword cobolReserved contained VARYING WHEN WITH WORDS WRITE99syn match   cobolReserved contained "\<CONTAINS\>"100syn match   cobolReserved contained "\<\(IF\|INVALID\|END\|EOP\)\>"101syn match   cobolReserved contained "\<ALL\>"102" #C22032019: Add BY as match instead of keyword: BY not followed by ==103syn match   cobolReserved contained "\<BY\>\s\+\(==\)\@!"104syn match   cobolReserved contained "\<TO\>"105 106syn cluster cobolLine     add=cobolConstant,cobolNumber,cobolPic107syn keyword cobolConstant SPACE SPACES NULL ZERO ZEROES ZEROS LOW-VALUE LOW-VALUES108 109" #C22032019: Fix for many pic clauses110syn match   cobolNumber       "\<-\=\d*\.\=\d\+\>" contained111" syn match   cobolPic		\"\<S*9\+\>" contained112syn match   cobolPic		"\<S*9\+V*9*\>" contained113syn match   cobolPic		"\<$*\.\=9\+\>" contained114syn match   cobolPic		"\<Z*\.\=9\+\>" contained115syn match   cobolPic		"\<V9\+\>" contained116syn match   cobolPic		"\<9\+V\>" contained117" syn match   cobolPic		\"\<-\+[Z9]\+\>" contained118syn match   cobolPic		"\<-*[Z9]\+-*\>" contained119" #C22032019: Add Z,X and A to cobolPic120syn match   cobolPic		"\<[ZXA]\+\>" contained121syn match   cobolTodo		"todo" contained containedin=cobolInlineComment,cobolComment122 123" For MicroFocus or other inline comments, include this line.124if g:cobol_inline_comment == 1125   syn region  cobolInlineComment     start="*>" end="$" contains=cobolTodo,cobolMarker126   syn cluster cobolLine       add=cobolInlineComment127endif128 129syn match   cobolBadLine      "[^ D\*$/-].*" contained130 131" If comment mark somehow gets into column past Column 7.132if g:cobol_inline_comment == 1133   " #C22032019: It is a bad line only if * is not followed by > when inline134   " comments enabled135   syn match   cobolBadLine      "\s\+\*\(>\)\@!.*" contained136else137   syn match   cobolBadLine      "\s\+\*.*" contained138endif139syn cluster cobolStart        add=cobolBadLine140 141" #C22032019: Different highlighting for GO TO statements142" syn keyword cobolGoTo		GO GOTO143syn keyword cobolGoTo		GOTO144syn match cobolGoTo		/\<GO\>\s\+\<TO\>/145syn match cobolGoToPara       /\<GO\>\s\+\<TO\>\s\+[A-Z0-9-]\+/ contains=cobolGoTo146" #C22032019: Highlight copybook name and location in using different group147" syn keyword cobolCopy		COPY148syn match cobolCopy		"\<COPY\>\|\<IN\>"149syn match cobolCopy           "\<REPLACING\>\s\+\(==\)\@="150syn match cobolCopy           "\<BY\>\s\+\(==\)\@="151syn match cobolCopyName       "\<COPY\>\s\+[A-Z0-9]\+\(\s\+\<IN\>\s\+[A-Z0-9]\+\)\?" contains=cobolCopy152syn cluster cobolLine         add=cobolGoToPara,cobolCopyName153 154" cobolBAD: things that are BAD NEWS!155syn keyword cobolBAD		ALTER ENTER RENAMES156 157syn cluster cobolLine       add=cobolGoTo,cobolCopy,cobolBAD,cobolWatch,cobolEXECs158 159" cobolWatch: things that are important when trying to understand a program160syn keyword cobolWatch		OCCURS DEPENDING VARYING BINARY COMP REDEFINES161" #C22032019: Remove REPLACING from cobolWatch 'keyword' group and add to cobolCopy &162"            cobolWatch 'match' group163" syn keyword cobolWatch		REPLACING RUN164syn keyword cobolWatch		RUN PROGRAM165syn match   cobolWatch contained "\<REPLACING\>\s\+\(==\)\@!"166" #C22032019: Look for word starting with COMP167" syn match   cobolWatch		\"COMP-[123456XN]"168syn match   cobolWatch		"\<COMP-[123456XN]"169 170syn keyword cobolEXECs		EXEC END-EXEC171 172 173syn cluster cobolAreaA      add=cobolDeclA174syn cluster cobolAreaAB     add=cobolDecl175syn match   cobolDeclA      "\(0\=1\|77\|78\) " contained nextgroup=cobolLine176syn match   cobolDecl		"[1-4]\d " contained nextgroup=cobolLine177syn match   cobolDecl		"0\=[2-9] " contained nextgroup=cobolLine178syn match   cobolDecl		"66 " contained nextgroup=cobolLine179 180syn match   cobolWatch		"88 " contained nextgroup=cobolLine181 182"syn match   cobolBadID		"\k\+-\($\|[^-A-Z0-9]\)" contained183 184syn cluster cobolLine       add=cobolCALLs,cobolString,cobolCondFlow185" #C22032019: Changes for cobolCALLs group to include thru186" syn keyword cobolCALLs		CALL END-CALL CANCEL GOBACK PERFORM END-PERFORM INVOKE187syn keyword cobolCALLs		END-CALL CANCEL GOBACK PERFORM END-PERFORM INVOKE THRU188" #C22032019: Highlight called program189" syn match   cobolCALLs		\"EXIT \+PROGRAM"190syn match   cobolCALLs		"\<CALL\>"191syn match   cobolCALLProg     /\<CALL\>\s\+"\{0,1\}[A-Z0-9]\+"\{0,1\}/ contains=cobolCALLs192syn match   cobolExtras       /\<VALUE \+\d\+\./hs=s+6,he=e-1193syn cluster cobolLine         add=cobolCALLProg194 195syn match   cobolString       /"[^"]*\("\|$\)/196syn match   cobolString       /'[^']*\('\|$\)/197 198"syn region  cobolLine        start="^.\{6}[ D-]" end="$" contains=ALL199syn match   cobolIndicator   "\%7c[D-]" contained200 201if exists("cobol_legacy_code")202  syn region  cobolCondFlow     contains=ALLBUT,cobolLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend203endif204 205" many legacy sources have junk in columns 1-6: must be before others206" Stuff after column 72 is in error - must be after all other "match" entries207if exists("cobol_legacy_code")208    syn match   cobolBadLine      "\%73c.*" containedin=ALLBUT,cobolComment209else210    " #C22032019: Use comment highlighting for bad lines 211    " syn match   cobolBadLine      \"\%73c.*" containedin=ALL212    syn match   cobolBadLine      "\%73c.*" containedin=ALL,cobolInlineComment,cobolComment213endif214 215" Define the default highlighting.216" Only when an item doesn't have highlighting yet217 218hi def link cobolBAD      Error219hi def link cobolBadID    Error220hi def link cobolBadLine  Error221if exists("g:cobol_legacy_code")222    hi def link cobolMarker   Comment223else224    hi def link cobolMarker   Error225endif226hi def link cobolCALLs          Function227hi def link cobolCALLProg       Special228hi def link cobolComment        Comment229hi def link cobolInlineComment  Comment  230hi def link cobolKeys           Comment231hi def link cobolAreaB          Special232hi def link cobolCompiler       PreProc233hi def link cobolCondFlow       Special234hi def link cobolCopy           PreProc235hi def link cobolCopyName       Special236hi def link cobolDeclA          cobolDecl237hi def link cobolDecl           Type238hi def link cobolExtras         Special239hi def link cobolGoTo           Special240hi def link cobolGoToPara       Function241hi def link cobolConstant       Constant242hi def link cobolNumber         Constant243hi def link cobolPic            Constant244hi def link cobolReserved       Statement245hi def link cobolDivision       Label246hi def link cobolSection        Label247hi def link cobolParagraph      Label248hi def link cobolDivisionName   Keyword249hi def link cobolSectionName    Keyword250hi def link cobolParagraphName  Keyword251hi def link cobolString         Constant252hi def link cobolTodo           Todo253hi def link cobolWatch          Special254hi def link cobolIndicator      Special255hi def link cobolStart          Comment256 257 258let b:current_syntax = "cobol"259 260" vim: ts=6 nowrap261 
codekingpro/portable-devtools · Team Ai