Mercurial > vim
comparison runtime/syntax/c.vim @ 1620:73fe8baea242
updated for version 7.2a
author | vimboss |
---|---|
date | Tue, 24 Jun 2008 21:16:56 +0000 |
parents | e63691e7c504 |
children | 7bc41231fbc7 |
comparison
equal
deleted
inserted
replaced
1619:b9740fb41986 | 1620:73fe8baea242 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: C | 2 " Language: C |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | 3 " Maintainer: Bram Moolenaar <Bram@vim.org> |
4 " Last Change: 2007 Feb 13 | 4 " Last Change: 2008 Mar 19 |
5 | 5 |
6 " Quit when a (custom) syntax file was already loaded | 6 " Quit when a (custom) syntax file was already loaded |
7 if exists("b:current_syntax") | 7 if exists("b:current_syntax") |
8 finish | 8 finish |
9 endif | 9 endif |
63 syn match cSpaceError display " \+\t"me=e-1 | 63 syn match cSpaceError display " \+\t"me=e-1 |
64 endif | 64 endif |
65 endif | 65 endif |
66 | 66 |
67 " This should be before cErrInParen to avoid problems with #define ({ xxx }) | 67 " This should be before cErrInParen to avoid problems with #define ({ xxx }) |
68 syntax region cBlock start="{" end="}" transparent fold | 68 if exists("c_curly_error") |
69 syntax match cCurlyError "}" | |
70 syntax region cBlock start="{" end="}" contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold | |
71 else | |
72 syntax region cBlock start="{" end="}" transparent fold | |
73 endif | |
69 | 74 |
70 "catch errors caused by wrong parenthesis and brackets | 75 "catch errors caused by wrong parenthesis and brackets |
71 " also accept <% for {, %> for }, <: for [ and :> for ] (C99) | 76 " also accept <% for {, %> for }, <: for [ and :> for ] (C99) |
72 " But avoid matching <::. | 77 " But avoid matching <::. |
73 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 | 78 syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom |
74 if exists("c_no_curly_error") | 79 if exists("c_no_curly_error") |
75 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell | 80 syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell |
76 " cCppParen: same as cParen but ends at end-of-line; used in cDefine | 81 " cCppParen: same as cParen but ends at end-of-line; used in cDefine |
77 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell | 82 syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell |
78 syn match cParenError display ")" | 83 syn match cParenError display ")" |
142 syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend | 147 syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend |
143 endif | 148 endif |
144 else | 149 else |
145 syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell | 150 syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell |
146 if exists("c_no_comment_fold") | 151 if exists("c_no_comment_fold") |
147 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell | 152 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend |
148 else | 153 else |
149 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold | 154 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend |
150 endif | 155 endif |
151 endif | 156 endif |
152 " keep a // comment separately, it terminates a preproc. conditional | 157 " keep a // comment separately, it terminates a preproc. conditional |
153 syntax match cCommentError display "\*/" | 158 syntax match cCommentError display "\*/" |
154 syntax match cCommentStartError display "/\*"me=e-1 contained | 159 syntax match cCommentStartError display "/\*"me=e-1 contained |
201 syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX | 206 syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX |
202 syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN | 207 syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN |
203 syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX | 208 syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX |
204 if !exists("c_no_c99") | 209 if !exists("c_no_c99") |
205 syn keyword cConstant __func__ | 210 syn keyword cConstant __func__ |
206 syn keyword cConstant LLONG_MAX ULLONG_MAX | 211 syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX |
207 syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN | 212 syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN |
208 syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX | 213 syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX |
209 syn keyword cConstant UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX | 214 syn keyword cConstant UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX |
210 syn keyword cConstant INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN | 215 syn keyword cConstant INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN |
211 syn keyword cConstant INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX | 216 syn keyword cConstant INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX |
302 let b:c_minlines = 50 " #if 0 constructs can be long | 307 let b:c_minlines = 50 " #if 0 constructs can be long |
303 else | 308 else |
304 let b:c_minlines = 15 " mostly for () constructs | 309 let b:c_minlines = 15 " mostly for () constructs |
305 endif | 310 endif |
306 endif | 311 endif |
307 exec "syn sync ccomment cComment minlines=" . b:c_minlines | 312 if exists("c_curly_error") |
313 syn sync fromstart | |
314 else | |
315 exec "syn sync ccomment cComment minlines=" . b:c_minlines | |
316 endif | |
308 | 317 |
309 " Define the default highlighting. | 318 " Define the default highlighting. |
310 " Only used when an item doesn't have highlighting yet | 319 " Only used when an item doesn't have highlighting yet |
311 hi def link cFormat cSpecial | 320 hi def link cFormat cSpecial |
312 hi def link cCppString cString | 321 hi def link cCppString cString |
328 hi def link cErrInBracket cError | 337 hi def link cErrInBracket cError |
329 hi def link cCommentError cError | 338 hi def link cCommentError cError |
330 hi def link cCommentStartError cError | 339 hi def link cCommentStartError cError |
331 hi def link cSpaceError cError | 340 hi def link cSpaceError cError |
332 hi def link cSpecialError cError | 341 hi def link cSpecialError cError |
342 hi def link cCurlyError cError | |
333 hi def link cOperator Operator | 343 hi def link cOperator Operator |
334 hi def link cStructure Structure | 344 hi def link cStructure Structure |
335 hi def link cStorageClass StorageClass | 345 hi def link cStorageClass StorageClass |
336 hi def link cInclude Include | 346 hi def link cInclude Include |
337 hi def link cPreProc PreProc | 347 hi def link cPreProc PreProc |