1" Vim syntax file 2" Language: CHILL 3" Maintainer: YoungSang Yoon <image@lgic.co.kr> 4" Last change: 2004 Jan 21 5" 6 7" first created by image@lgic.co.kr & modified by paris@lgic.co.kr 8 9" CHILL (CCITT High Level Programming Language) is used for 10" developing software of ATM switch at LGIC (LG Information 11" & Communications LTd.) 12 13 14" For version 5.x: Clear all syntax items 15" For version 6.x: Quit when a syntax file was already loaded 16if version < 600 17 syntax clear 18elseif exists("b:current_syntax") 19 finish 20endif 21 22" A bunch of useful CHILL keywords 23syn keyword chillStatement goto GOTO return RETURN returns RETURNS 24syn keyword chillLabel CASE case ESAC esac 25syn keyword chillConditional if IF else ELSE elsif ELSIF switch SWITCH THEN then FI fi 26syn keyword chillLogical NOT not 27syn keyword chillRepeat while WHILE for FOR do DO od OD TO to 28syn keyword chillProcess START start STACKSIZE stacksize PRIORITY priority THIS this STOP stop 29syn keyword chillBlock PROC proc PROCESS process 30syn keyword chillSignal RECEIVE receive SEND send NONPERSISTENT nonpersistent PERSISTENT peristent SET set EVER ever 31 32syn keyword chillTodo contained TODO FIXME XXX 33 34" String and Character constants 35" Highlight special characters (those which have a backslash) differently 36syn match chillSpecial contained "\\x\x\+\|\\\o\{1,3\}\|\\.\|\\$" 37syn region chillString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=chillSpecial 38syn match chillCharacter "'[^\\]'" 39syn match chillSpecialCharacter "'\\.'" 40syn match chillSpecialCharacter "'\\\o\{1,3\}'" 41 42"when wanted, highlight trailing white space 43if exists("chill_space_errors") 44 syn match chillSpaceError "\s*$" 45 syn match chillSpaceError " \+\t"me=e-1 46endif 47 48"catch errors caused by wrong parenthesis 49syn cluster chillParenGroup contains=chillParenError,chillIncluded,chillSpecial,chillTodo,chillUserCont,chillUserLabel,chillBitField 50syn region chillParen transparent start='(' end=')' contains=ALLBUT,@chillParenGroup 51syn match chillParenError ")" 52syn match chillInParen contained "[{}]" 53 54"integer number, or floating point number without a dot and with "f". 55syn case ignore 56syn match chillNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" 57"floating point number, with dot, optional exponent 58syn match chillFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" 59"floating point number, starting with a dot, optional exponent 60syn match chillFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" 61"floating point number, without dot, with exponent 62syn match chillFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" 63"hex number 64syn match chillNumber "\<0x\x\+\(u\=l\=\|lu\)\>" 65"syn match chillIdentifier "\<[a-z_][a-z0-9_]*\>" 66syn case match 67" flag an octal number with wrong digits 68syn match chillOctalError "\<0\o*[89]" 69 70if exists("chill_comment_strings") 71 " A comment can contain chillString, chillCharacter and chillNumber. 72 " But a "*/" inside a chillString in a chillComment DOES end the comment! So we 73 " need to use a special type of chillString: chillCommentString, which also ends on 74 " "*/", and sees a "*" at the start of the line as comment again. 75 " Unfortunately this doesn't very well work for // type of comments :-( 76 syntax match chillCommentSkip contained "^\s*\*\($\|\s\+\)" 77 syntax region chillCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=chillSpecial,chillCommentSkip 78 syntax region chillComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=chillSpecial 79 syntax region chillComment start="/\*" end="\*/" contains=chillTodo,chillCommentString,chillCharacter,chillNumber,chillFloat,chillSpaceError 80 syntax match chillComment "//.*" contains=chillTodo,chillComment2String,chillCharacter,chillNumber,chillSpaceError 81else 82 syn region chillComment start="/\*" end="\*/" contains=chillTodo,chillSpaceError 83 syn match chillComment "//.*" contains=chillTodo,chillSpaceError 84endif 85syntax match chillCommentError "\*/" 86 87syn keyword chillOperator SIZE size 88syn keyword chillType dcl DCL int INT char CHAR bool BOOL REF ref LOC loc INSTANCE instance 89syn keyword chillStructure struct STRUCT enum ENUM newmode NEWMODE synmode SYNMODE 90"syn keyword chillStorageClass 91syn keyword chillBlock PROC proc END end 92syn keyword chillScope GRANT grant SEIZE seize 93syn keyword chillEDML select SELECT delete DELETE update UPDATE in IN seq SEQ WHERE where INSERT insert include INCLUDE exclude EXCLUDE 94syn keyword chillBoolConst true TRUE false FALSE 95 96syn region chillPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=chillComment,chillString,chillCharacter,chillNumber,chillCommentError,chillSpaceError 97syn region chillIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ 98syn match chillIncluded contained "<[^>]*>" 99syn match chillInclude "^\s*#\s*include\>\s*["<]" contains=chillIncluded 100"syn match chillLineSkip "\\$" 101syn cluster chillPreProcGroup contains=chillPreCondit,chillIncluded,chillInclude,chillDefine,chillInParen,chillUserLabel 102syn region chillDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@chillPreProcGroup 103syn region chillPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,@chillPreProcGroup 104 105" Highlight User Labels 106syn cluster chillMultiGroup contains=chillIncluded,chillSpecial,chillTodo,chillUserCont,chillUserLabel,chillBitField 107syn region chillMulti transparent start='?' end=':' contains=ALLBUT,@chillMultiGroup 108" Avoid matching foo::bar() in C++ by requiring that the next char is not ':' 109syn match chillUserCont "^\s*\I\i*\s*:$" contains=chillUserLabel 110syn match chillUserCont ";\s*\I\i*\s*:$" contains=chillUserLabel 111syn match chillUserCont "^\s*\I\i*\s*:[^:]"me=e-1 contains=chillUserLabel 112syn match chillUserCont ";\s*\I\i*\s*:[^:]"me=e-1 contains=chillUserLabel 113 114syn match chillUserLabel "\I\i*" contained 115 116" Avoid recognizing most bitfields as labels 117syn match chillBitField "^\s*\I\i*\s*:\s*[1-9]"me=e-1 118syn match chillBitField ";\s*\I\i*\s*:\s*[1-9]"me=e-1 119 120syn match chillBracket contained "[<>]" 121if !exists("chill_minlines") 122 let chill_minlines = 15 123endif 124exec "syn sync ccomment chillComment minlines=" . chill_minlines 125 126" Define the default highlighting. 127" For version 5.7 and earlier: only when not done already 128" For version 5.8 and later: only when an item doesn't have highlighting yet 129if version >= 508 || !exists("did_ch_syntax_inits") 130 if version < 508 131 let did_ch_syntax_inits = 1 132 command -nargs=+ HiLink hi link <args> 133 else 134 command -nargs=+ HiLink hi def link <args> 135 endif 136 137 HiLink chillLabel Label 138 HiLink chillUserLabel Label 139 HiLink chillConditional Conditional 140 " hi chillConditional term=bold ctermfg=red guifg=red gui=bold 141 142 HiLink chillRepeat Repeat 143 HiLink chillProcess Repeat 144 HiLink chillSignal Repeat 145 HiLink chillCharacter Character 146 HiLink chillSpecialCharacter chillSpecial 147 HiLink chillNumber Number 148 HiLink chillFloat Float 149 HiLink chillOctalError chillError 150 HiLink chillParenError chillError 151 HiLink chillInParen chillError 152 HiLink chillCommentError chillError 153 HiLink chillSpaceError chillError 154 HiLink chillOperator Operator 155 HiLink chillStructure Structure 156 HiLink chillBlock Operator 157 HiLink chillScope Operator 158 "hi chillEDML term=underline ctermfg=DarkRed guifg=Red 159 HiLink chillEDML PreProc 160 "hi chillBoolConst term=bold ctermfg=brown guifg=brown 161 HiLink chillBoolConst Constant 162 "hi chillLogical term=bold ctermfg=brown guifg=brown 163 HiLink chillLogical Constant 164 HiLink chillStorageClass StorageClass 165 HiLink chillInclude Include 166 HiLink chillPreProc PreProc 167 HiLink chillDefine Macro 168 HiLink chillIncluded chillString 169 HiLink chillError Error 170 HiLink chillStatement Statement 171 HiLink chillPreCondit PreCondit 172 HiLink chillType Type 173 HiLink chillCommentError chillError 174 HiLink chillCommentString chillString 175 HiLink chillComment2String chillString 176 HiLink chillCommentSkip chillComment 177 HiLink chillString String 178 HiLink chillComment Comment 179 " hi chillComment term=None ctermfg=lightblue guifg=lightblue 180 HiLink chillSpecial SpecialChar 181 HiLink chillTodo Todo 182 HiLink chillBlock Statement 183 "HiLink chillIdentifier Identifier 184 HiLink chillBracket Delimiter 185 186 delcommand HiLink 187endif 188 189let b:current_syntax = "chill" 190 191" vim: ts=8 192