3 " Maintainer: billiob <billiob@gmail.com>
4 " Last Change: 05/08/2011
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 " 1) Copy this file to $HOME/.vim/syntax/
11 " 2) Paste the following line to your $HOME/.vimrc file to load the syntax
14 " au BufNewFile,BufRead *.edc set syntax=edc
18 elseif exists("b:current_syntax")
22 " A bunch of useful C keywords
23 syn keyword cStructure images data fonts collections group externals
24 syn keyword cStructure part parts dragable description rel1 rel2
25 syn keyword cStatement text image font fill origin size tag
26 syn keyword cStructure programs program script script_only lua_script lua_script_only styles style base
27 syn keyword cStructure spectra spectrum box
28 syn match cType "+ + +;" contained
30 syn keyword cLabel item name min max type effect
31 syn keyword cLabel mouse_events repeat_events clip_to
32 syn keyword cLabel color_class text_class x y confine
33 syn keyword cLabel state visible align step aspect aspect_preference fixed
34 syn keyword cLabel relative offset to to_x to_y normal tween
35 syn keyword cLabel border color color2 color3 font size fit align
36 syn keyword cLabel signal source action transition in target after
37 syn keyword cLabel text smooth inherit scale middle ignore_flags
38 syn keyword cLabel alias events entry_mode select_mode multiline
39 syn keyword cLabel source1 source2 source3 source4 source5 source6
40 syn keyword cLabel text_source transitions layout padding
41 syn keyword cLabel size_w size_h size_max_w size_max_h size_min_w size_min_w
42 syn keyword cLabel spread scale_hint elipsis ellipsis pointer_mode prefer
43 syn keyword cLabel precise_is_inside use_alternate_font_metrics options
44 syn keyword cLabel aspect_mode position span angle repch api
45 syn keyword cLabel external params size_range border_scale
47 syn keyword cConditional if else switch
48 syn keyword cRepeat while for do
49 syn keyword cConstant COMP RAW LOSSY USER
50 syn keyword cConstant RECT TEXT IMAGE SWALLOW TEXTBLOCK GRADIENT
51 syn keyword cConstant GROUP BOX TABLE EXTERNAL ITEM
52 syn keyword cConstant SOLID AUTOGRAB NOGRAB
53 syn keyword cConstant NONE PLAIN OUTLINE SOFT_OUTLINE SHADOW
54 syn keyword cConstant SOFT_SHADOW OUTLINE_SHADOW OUTLINE_SOFT_SHADOW
55 syn keyword cConstant FAR_SOFT_SHADOW FAR_SHADOW GLOW
56 syn keyword cConstant STATE_SET ACTION_STOP SIGNAL_EMIT
57 syn keyword cConstant SCRIPT LUA_SCRIPT
58 syn keyword cConstant DRAG_VAL_SET DRAG_VAL_STEP DRAG_VAL_PAGE
59 syn keyword cConstant LINEAR SINUSOIDAL ACCELERATE DECELERATE
60 syn keyword cConstant VERTICAL HORIZONTAL ON_HOLD BOTH EDITABLE EXPLICIT
61 syn keyword cConstant FOCUS_SET "default" NEITHER
62 syn keyword cConstant DYNAMIC STATIC
64 syn keyword cTodo contained TODO FIXME XXX
66 " cCommentGroup allows adding matches for special things in comments
67 syn cluster cCommentGroup contains=cTodo
69 " String and Character constants
70 " Highlight special characters (those which have a backslash) differently
71 syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
72 if !exists("c_no_utf")
73 syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
75 if exists("c_no_cformat")
76 syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial
77 " cCppString: same as cString, but ends at end of line
78 syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial
80 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
81 syn match cFormat display "%%" contained
82 syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat
83 " cCppString: same as cString, but ends at end of line
84 syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat
87 syn match cCharacter "L\='[^\\]'"
88 syn match cCharacter "L'[^']*'" contains=cSpecial
90 syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
91 syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
93 syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
94 syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
96 syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
97 syn match cSpecialCharacter display "'\\x\x\{1,2}'"
98 syn match cSpecialCharacter display "L'\\x\x\+'"
100 "when wanted, highlight trailing white space
101 if exists("c_space_errors")
102 if !exists("c_no_trail_space_error")
103 syn match cSpaceError display excludenl "\s\+$"
105 if !exists("c_no_tab_space_error")
106 syn match cSpaceError display " \+\t"me=e-1
110 "catch errors caused by wrong parenthesis and brackets
111 syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cCommentSkip,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
112 if exists("c_no_bracket_error")
113 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString
114 " cCppParen: same as cParen but ends at end-of-line; used in cDefine
115 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString
116 syn match cParenError display ")"
117 syn match cErrInParen display contained "[{}]"
119 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString
120 " cCppParen: same as cParen but ends at end-of-line; used in cDefine
121 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString
122 syn match cParenError display "[\])]"
123 syn match cErrInParen display contained "[\]{}]"
124 syn region cBracket transparent start='\[' end=']' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString
125 " cCppBracket: same as cParen but ends at end-of-line; used in cDefine
126 syn region cCppBracket transparent start='\[' skip='\\$' excludenl end=']' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString
127 syn match cErrInBracket display contained "[);{}]"
130 "integer number, or floating point number without a dot and with "f".
132 syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal
133 " Same, but without octal error (for comments)
134 syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal
135 syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
137 syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
138 " Flag the first zero of an octal number as something special
139 syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
140 syn match cOctalZero display contained "\<0"
141 syn match cFloat display contained "\d\+f"
142 "floating point number, with dot, optional exponent
143 syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
144 "floating point number, starting with a dot, optional exponent
145 syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
146 "floating point number, without dot, with exponent
147 syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
148 " flag an octal number with wrong digits
149 syn match cOctalError display contained "0\o*[89]\d*"
152 if exists("c_comment_strings")
153 " A comment can contain cString, cCharacter and cNumber.
154 " But a "*/" inside a cString in a cComment DOES end the comment! So we
155 " need to use a special type of cString: cCommentString, which also ends on
156 " "*/", and sees a "*" at the start of the line as comment again.
157 " Unfortunately this doesn't very well work for // type of comments :-(
158 syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
159 syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
160 syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
161 syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError
162 syntax region cComment matchgroup=cCommentStart start="/\*" matchgroup=NONE end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError
164 syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError
165 syn region cComment matchgroup=cCommentStart start="/\*" matchgroup=NONE end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError
167 " keep a // comment separately, it terminates a preproc. conditional
168 syntax match cCommentError display "\*/"
169 syntax match cCommentStartError display "/\*"me=e-1 contained
171 syn keyword cOperator sizeof
173 syn keyword cStatement __asm__
174 syn keyword cOperator typeof __real__ __imag__
176 syn keyword cType int long short char void
177 syn keyword cType signed unsigned float double
178 if !exists("c_no_ansi") || exists("c_ansi_typedefs")
179 syn keyword cType size_t wchar_t ptrdiff_t sig_atomic_t fpos_t
180 syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t
181 syn keyword cType mbstate_t wctrans_t wint_t wctype_t
183 if !exists("c_no_c99") " ISO C99
184 syn keyword cType bool complex
185 syn keyword cType int8_t int16_t int32_t int64_t
186 syn keyword cType uint8_t uint16_t uint32_t uint64_t
187 syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
188 syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
189 syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
190 syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
191 syn keyword cType intptr_t uintptr_t
192 syn keyword cType intmax_t uintmax_t
195 syn keyword cType __label__ __complex__ __volatile__
198 syn keyword cStructure struct union enum typedef
199 syn keyword cStorageClass static register auto volatile extern const
201 syn keyword cStorageClass inline __attribute__
204 if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
206 syn keyword cConstant __GNUC__ __FUNCTION__ __PRETTY_FUNCTION__
208 syn keyword cConstant __LINE__ __FILE__ __DATE__ __TIME__ __STDC__
209 syn keyword cConstant __STDC_VERSION__
210 syn keyword cConstant CHAR_BIT MB_LEN_MAX MB_CUR_MAX
211 syn keyword cConstant UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
212 syn keyword cConstant CHAR_MIN INT_MIN LONG_MIN SHRT_MIN
213 syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX
214 syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
215 syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
216 syn keyword cConstant FLT_RADIX FLT_ROUNDS
217 syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON
218 syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON
219 syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON
220 syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP
221 syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP
222 syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP
223 syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP
224 syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
225 syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP
226 syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL
227 syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY
228 syn keyword cConstant LC_NUMERIC LC_TIME
229 syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN
230 syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM
231 " Add POSIX signals as well...
232 syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP
233 syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV
234 syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU
235 syn keyword cConstant SIGUSR1 SIGUSR2
236 syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF
237 syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam
238 syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET
239 syn keyword cConstant TMP_MAX stderr stdin stdout
240 syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
241 " Add POSIX errors as well
242 syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY
243 syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT
244 syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR
245 syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV
246 syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS
247 syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM
248 syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV
250 syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4
251 syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2
253 if !exists("c_no_c99") " ISO C99
254 syn keyword cConstant true false
257 syn region cPreCondit start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
258 syn match cPreCondit display "^\s*#\s*\(else\|endif\)\>"
259 if !exists("c_no_if0")
260 syn region cCppOut start="^\s*#\s*if\s\+0\+\>" end=".\|$" contains=cCppOut2
261 syn region cCppOut2 contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip
262 syn region cCppSkip contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=cSpaceError,cCppSkip
264 syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
265 syn match cIncluded display contained "<[^>]*>"
266 syn match cInclude display "^\s*#\s*include\>\s*["<]" contains=cIncluded
267 "syn match cLineSkip "\\$"
268 syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti
269 syn region cDefine start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 contains=ALLBUT,@cPreProcGroup
270 syn region cPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup
272 syn match cUserLabel display "\I\i*" contained
276 if exists("c_minlines")
277 let b:c_minlines = c_minlines
279 if !exists("c_no_if0")
280 let b:c_minlines = 50 " #if 0 constructs can be long
282 let b:c_minlines = 15 " mostly for () constructs
285 exec "syn sync ccomment cComment minlines=" . b:c_minlines
287 " Define the default highlighting.
288 " For version 5.7 and earlier: only when not done already
289 " For version 5.8 and later: only when an item doesn't have highlighting yet
290 if version >= 508 || !exists("did_c_syn_inits")
292 let did_c_syn_inits = 1
293 command -nargs=+ HiLink hi link <args>
295 command -nargs=+ HiLink hi def link <args>
298 HiLink cFormat cSpecial
299 HiLink cCppString cString
300 HiLink cCommentL cComment
301 HiLink cCommentStart cComment
303 HiLink cUserLabel Label
304 HiLink cConditional Conditional
305 HiLink cRepeat Repeat
306 HiLink cCharacter Character
307 HiLink cSpecialCharacter cSpecial
308 HiLink cNumber Number
310 HiLink cOctalZero PreProc " link this to Error if you want
312 HiLink cOctalError cError
313 HiLink cParenError cError
314 HiLink cErrInParen cError
315 HiLink cErrInBracket cError
316 HiLink cCommentError cError
317 HiLink cCommentStartError cError
318 HiLink cSpaceError cError
319 HiLink cSpecialError cError
320 HiLink cOperator Operator
321 HiLink cStructure Structure
322 HiLink cStorageClass StorageClass
323 HiLink cInclude Include
324 HiLink cPreProc PreProc
326 HiLink cIncluded cString
328 HiLink cStatement Statement
329 HiLink cPreCondit PreCondit
331 HiLink cConstant Constant
332 HiLink cCommentString cString
333 HiLink cComment2String cString
334 HiLink cCommentSkip cComment
335 HiLink cString String
336 HiLink cComment Comment
337 HiLink cSpecial SpecialChar
339 HiLink cCppSkip cCppOut
340 HiLink cCppOut2 cCppOut
341 HiLink cCppOut Comment
346 let b:current_syntax = "edc"