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