1071d4279SBram Moolenaar" Vim syntax file 2071d4279SBram Moolenaar" Language: CHILL 3071d4279SBram Moolenaar" Maintainer: YoungSang Yoon <[email protected]> 4071d4279SBram Moolenaar" Last change: 2004 Jan 21 5071d4279SBram Moolenaar" 6071d4279SBram Moolenaar 7071d4279SBram Moolenaar" first created by [email protected] & modified by [email protected] 8071d4279SBram Moolenaar 9071d4279SBram Moolenaar" CHILL (CCITT High Level Programming Language) is used for 10071d4279SBram Moolenaar" developing software of ATM switch at LGIC (LG Information 11071d4279SBram Moolenaar" & Communications LTd.) 12071d4279SBram Moolenaar 13071d4279SBram Moolenaar 1489bcfda6SBram Moolenaar" quit when a syntax file was already loaded 1589bcfda6SBram Moolenaarif exists("b:current_syntax") 16071d4279SBram Moolenaar finish 17071d4279SBram Moolenaarendif 18071d4279SBram Moolenaar 19071d4279SBram Moolenaar" A bunch of useful CHILL keywords 20071d4279SBram Moolenaarsyn keyword chillStatement goto GOTO return RETURN returns RETURNS 21071d4279SBram Moolenaarsyn keyword chillLabel CASE case ESAC esac 22071d4279SBram Moolenaarsyn keyword chillConditional if IF else ELSE elsif ELSIF switch SWITCH THEN then FI fi 23071d4279SBram Moolenaarsyn keyword chillLogical NOT not 24071d4279SBram Moolenaarsyn keyword chillRepeat while WHILE for FOR do DO od OD TO to 25071d4279SBram Moolenaarsyn keyword chillProcess START start STACKSIZE stacksize PRIORITY priority THIS this STOP stop 26071d4279SBram Moolenaarsyn keyword chillBlock PROC proc PROCESS process 27071d4279SBram Moolenaarsyn keyword chillSignal RECEIVE receive SEND send NONPERSISTENT nonpersistent PERSISTENT peristent SET set EVER ever 28071d4279SBram Moolenaar 29071d4279SBram Moolenaarsyn keyword chillTodo contained TODO FIXME XXX 30071d4279SBram Moolenaar 31071d4279SBram Moolenaar" String and Character constants 32071d4279SBram Moolenaar" Highlight special characters (those which have a backslash) differently 33071d4279SBram Moolenaarsyn match chillSpecial contained "\\x\x\+\|\\\o\{1,3\}\|\\.\|\\$" 34071d4279SBram Moolenaarsyn region chillString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=chillSpecial 35071d4279SBram Moolenaarsyn match chillCharacter "'[^\\]'" 36071d4279SBram Moolenaarsyn match chillSpecialCharacter "'\\.'" 37071d4279SBram Moolenaarsyn match chillSpecialCharacter "'\\\o\{1,3\}'" 38071d4279SBram Moolenaar 39071d4279SBram Moolenaar"when wanted, highlight trailing white space 40071d4279SBram Moolenaarif exists("chill_space_errors") 41071d4279SBram Moolenaar syn match chillSpaceError "\s*$" 42071d4279SBram Moolenaar syn match chillSpaceError " \+\t"me=e-1 43071d4279SBram Moolenaarendif 44071d4279SBram Moolenaar 45071d4279SBram Moolenaar"catch errors caused by wrong parenthesis 46071d4279SBram Moolenaarsyn cluster chillParenGroup contains=chillParenError,chillIncluded,chillSpecial,chillTodo,chillUserCont,chillUserLabel,chillBitField 47071d4279SBram Moolenaarsyn region chillParen transparent start='(' end=')' contains=ALLBUT,@chillParenGroup 48071d4279SBram Moolenaarsyn match chillParenError ")" 49071d4279SBram Moolenaarsyn match chillInParen contained "[{}]" 50071d4279SBram Moolenaar 51071d4279SBram Moolenaar"integer number, or floating point number without a dot and with "f". 52071d4279SBram Moolenaarsyn case ignore 53071d4279SBram Moolenaarsyn match chillNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" 54071d4279SBram Moolenaar"floating point number, with dot, optional exponent 55071d4279SBram Moolenaarsyn match chillFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" 56071d4279SBram Moolenaar"floating point number, starting with a dot, optional exponent 57071d4279SBram Moolenaarsyn match chillFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" 58071d4279SBram Moolenaar"floating point number, without dot, with exponent 59071d4279SBram Moolenaarsyn match chillFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" 60071d4279SBram Moolenaar"hex number 61071d4279SBram Moolenaarsyn match chillNumber "\<0x\x\+\(u\=l\=\|lu\)\>" 62071d4279SBram Moolenaar"syn match chillIdentifier "\<[a-z_][a-z0-9_]*\>" 63071d4279SBram Moolenaarsyn case match 64071d4279SBram Moolenaar" flag an octal number with wrong digits 65071d4279SBram Moolenaarsyn match chillOctalError "\<0\o*[89]" 66071d4279SBram Moolenaar 67071d4279SBram Moolenaarif exists("chill_comment_strings") 68071d4279SBram Moolenaar " A comment can contain chillString, chillCharacter and chillNumber. 69071d4279SBram Moolenaar " But a "*/" inside a chillString in a chillComment DOES end the comment! So we 70071d4279SBram Moolenaar " need to use a special type of chillString: chillCommentString, which also ends on 71071d4279SBram Moolenaar " "*/", and sees a "*" at the start of the line as comment again. 72071d4279SBram Moolenaar " Unfortunately this doesn't very well work for // type of comments :-( 73071d4279SBram Moolenaar syntax match chillCommentSkip contained "^\s*\*\($\|\s\+\)" 74071d4279SBram Moolenaar syntax region chillCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=chillSpecial,chillCommentSkip 75071d4279SBram Moolenaar syntax region chillComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=chillSpecial 76071d4279SBram Moolenaar syntax region chillComment start="/\*" end="\*/" contains=chillTodo,chillCommentString,chillCharacter,chillNumber,chillFloat,chillSpaceError 77071d4279SBram Moolenaar syntax match chillComment "//.*" contains=chillTodo,chillComment2String,chillCharacter,chillNumber,chillSpaceError 78071d4279SBram Moolenaarelse 79071d4279SBram Moolenaar syn region chillComment start="/\*" end="\*/" contains=chillTodo,chillSpaceError 80071d4279SBram Moolenaar syn match chillComment "//.*" contains=chillTodo,chillSpaceError 81071d4279SBram Moolenaarendif 82071d4279SBram Moolenaarsyntax match chillCommentError "\*/" 83071d4279SBram Moolenaar 84071d4279SBram Moolenaarsyn keyword chillOperator SIZE size 85071d4279SBram Moolenaarsyn keyword chillType dcl DCL int INT char CHAR bool BOOL REF ref LOC loc INSTANCE instance 86071d4279SBram Moolenaarsyn keyword chillStructure struct STRUCT enum ENUM newmode NEWMODE synmode SYNMODE 87071d4279SBram Moolenaar"syn keyword chillStorageClass 88071d4279SBram Moolenaarsyn keyword chillBlock PROC proc END end 89071d4279SBram Moolenaarsyn keyword chillScope GRANT grant SEIZE seize 90071d4279SBram Moolenaarsyn keyword chillEDML select SELECT delete DELETE update UPDATE in IN seq SEQ WHERE where INSERT insert include INCLUDE exclude EXCLUDE 91071d4279SBram Moolenaarsyn keyword chillBoolConst true TRUE false FALSE 92071d4279SBram Moolenaar 93071d4279SBram Moolenaarsyn region chillPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=chillComment,chillString,chillCharacter,chillNumber,chillCommentError,chillSpaceError 94071d4279SBram Moolenaarsyn region chillIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ 95071d4279SBram Moolenaarsyn match chillIncluded contained "<[^>]*>" 96071d4279SBram Moolenaarsyn match chillInclude "^\s*#\s*include\>\s*["<]" contains=chillIncluded 97071d4279SBram Moolenaar"syn match chillLineSkip "\\$" 98071d4279SBram Moolenaarsyn cluster chillPreProcGroup contains=chillPreCondit,chillIncluded,chillInclude,chillDefine,chillInParen,chillUserLabel 99071d4279SBram Moolenaarsyn region chillDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@chillPreProcGroup 100071d4279SBram Moolenaarsyn region chillPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,@chillPreProcGroup 101071d4279SBram Moolenaar 102071d4279SBram Moolenaar" Highlight User Labels 103071d4279SBram Moolenaarsyn cluster chillMultiGroup contains=chillIncluded,chillSpecial,chillTodo,chillUserCont,chillUserLabel,chillBitField 104071d4279SBram Moolenaarsyn region chillMulti transparent start='?' end=':' contains=ALLBUT,@chillMultiGroup 105071d4279SBram Moolenaar" Avoid matching foo::bar() in C++ by requiring that the next char is not ':' 106071d4279SBram Moolenaarsyn match chillUserCont "^\s*\I\i*\s*:$" contains=chillUserLabel 107071d4279SBram Moolenaarsyn match chillUserCont ";\s*\I\i*\s*:$" contains=chillUserLabel 108071d4279SBram Moolenaarsyn match chillUserCont "^\s*\I\i*\s*:[^:]"me=e-1 contains=chillUserLabel 109071d4279SBram Moolenaarsyn match chillUserCont ";\s*\I\i*\s*:[^:]"me=e-1 contains=chillUserLabel 110071d4279SBram Moolenaar 111071d4279SBram Moolenaarsyn match chillUserLabel "\I\i*" contained 112071d4279SBram Moolenaar 113071d4279SBram Moolenaar" Avoid recognizing most bitfields as labels 114071d4279SBram Moolenaarsyn match chillBitField "^\s*\I\i*\s*:\s*[1-9]"me=e-1 115071d4279SBram Moolenaarsyn match chillBitField ";\s*\I\i*\s*:\s*[1-9]"me=e-1 116071d4279SBram Moolenaar 117071d4279SBram Moolenaarsyn match chillBracket contained "[<>]" 118071d4279SBram Moolenaarif !exists("chill_minlines") 119071d4279SBram Moolenaar let chill_minlines = 15 120071d4279SBram Moolenaarendif 121071d4279SBram Moolenaarexec "syn sync ccomment chillComment minlines=" . chill_minlines 122071d4279SBram Moolenaar 123071d4279SBram Moolenaar" Define the default highlighting. 12489bcfda6SBram Moolenaar" Only when an item doesn't have highlighting yet 125071d4279SBram Moolenaar 126*f37506f6SBram Moolenaarhi def link chillLabel Label 127*f37506f6SBram Moolenaarhi def link chillUserLabel Label 128*f37506f6SBram Moolenaarhi def link chillConditional Conditional 129*f37506f6SBram Moolenaar" hi def link chillConditional term=bold ctermfg=red guifg=red gui=bold 130071d4279SBram Moolenaar 131*f37506f6SBram Moolenaarhi def link chillRepeat Repeat 132*f37506f6SBram Moolenaarhi def link chillProcess Repeat 133*f37506f6SBram Moolenaarhi def link chillSignal Repeat 134*f37506f6SBram Moolenaarhi def link chillCharacter Character 135*f37506f6SBram Moolenaarhi def link chillSpecialCharacter chillSpecial 136*f37506f6SBram Moolenaarhi def link chillNumber Number 137*f37506f6SBram Moolenaarhi def link chillFloat Float 138*f37506f6SBram Moolenaarhi def link chillOctalError chillError 139*f37506f6SBram Moolenaarhi def link chillParenError chillError 140*f37506f6SBram Moolenaarhi def link chillInParen chillError 141*f37506f6SBram Moolenaarhi def link chillCommentError chillError 142*f37506f6SBram Moolenaarhi def link chillSpaceError chillError 143*f37506f6SBram Moolenaarhi def link chillOperator Operator 144*f37506f6SBram Moolenaarhi def link chillStructure Structure 145*f37506f6SBram Moolenaarhi def link chillBlock Operator 146*f37506f6SBram Moolenaarhi def link chillScope Operator 147*f37506f6SBram Moolenaar"hi def link chillEDML term=underline ctermfg=DarkRed guifg=Red 148*f37506f6SBram Moolenaarhi def link chillEDML PreProc 149*f37506f6SBram Moolenaar"hi def link chillBoolConst term=bold ctermfg=brown guifg=brown 150*f37506f6SBram Moolenaarhi def link chillBoolConst Constant 151*f37506f6SBram Moolenaar"hi def link chillLogical term=bold ctermfg=brown guifg=brown 152*f37506f6SBram Moolenaarhi def link chillLogical Constant 153*f37506f6SBram Moolenaarhi def link chillStorageClass StorageClass 154*f37506f6SBram Moolenaarhi def link chillInclude Include 155*f37506f6SBram Moolenaarhi def link chillPreProc PreProc 156*f37506f6SBram Moolenaarhi def link chillDefine Macro 157*f37506f6SBram Moolenaarhi def link chillIncluded chillString 158*f37506f6SBram Moolenaarhi def link chillError Error 159*f37506f6SBram Moolenaarhi def link chillStatement Statement 160*f37506f6SBram Moolenaarhi def link chillPreCondit PreCondit 161*f37506f6SBram Moolenaarhi def link chillType Type 162*f37506f6SBram Moolenaarhi def link chillCommentError chillError 163*f37506f6SBram Moolenaarhi def link chillCommentString chillString 164*f37506f6SBram Moolenaarhi def link chillComment2String chillString 165*f37506f6SBram Moolenaarhi def link chillCommentSkip chillComment 166*f37506f6SBram Moolenaarhi def link chillString String 167*f37506f6SBram Moolenaarhi def link chillComment Comment 168*f37506f6SBram Moolenaar" hi def link chillComment term=None ctermfg=lightblue guifg=lightblue 169*f37506f6SBram Moolenaarhi def link chillSpecial SpecialChar 170*f37506f6SBram Moolenaarhi def link chillTodo Todo 171*f37506f6SBram Moolenaarhi def link chillBlock Statement 172*f37506f6SBram Moolenaar"hi def link chillIdentifier Identifier 173*f37506f6SBram Moolenaarhi def link chillBracket Delimiter 174071d4279SBram Moolenaar 175071d4279SBram Moolenaar 176071d4279SBram Moolenaarlet b:current_syntax = "chill" 177071d4279SBram Moolenaar 178071d4279SBram Moolenaar" vim: ts=8 179