| " Vim syntax file |
| " Language: ACT c generation lang |
| " Maintainer: FRC Team 971 <spartanrobotics.org> |
| " Last Change: sometime |
| |
| " Quit when a (custom) syntax file was already loaded |
| if exists("b:current_syntax") |
| finish |
| endif |
| |
| syn keyword cTodo contained TODO FIXME XXX |
| |
| " It's easy to accidentally add a space after a backslash that was intended |
| " for line continuation. Some compilers allow it, which makes it |
| " unpredicatable and should be avoided. |
| syn match cBadContinuation contained "\\\s\+$" |
| |
| " cCommentGroup allows adding matches for special things in comments |
| syn cluster cCommentGroup contains=cTodo,cBadContinuation |
| |
| " This should be before cErrInParen to avoid problems with #define ({ xxx }) |
| if exists("c_curly_error") |
| syntax match cCurlyError "}" |
| syntax region cBlock start="{" end="}" contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold |
| else |
| syntax region cBlock start="{" end="}" transparent fold |
| endif |
| |
| |
| |
| if exists("c_comment_strings") |
| " A comment can contain cString, cCharacter and cNumber. |
| " But a "*/" inside a cString in a cComment DOES end the comment! So we |
| " need to use a special type of cString: cCommentString, which also ends on |
| " "*/", and sees a "*" at the start of the line as comment again. |
| " Unfortunately this doesn't very well work for // type of comments :-( |
| syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)" |
| syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip |
| syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial |
| syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell |
| if exists("c_no_comment_fold") |
| " Use "extend" here to have preprocessor lines not terminate halfway a |
| " comment. |
| syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend |
| else |
| syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend |
| endif |
| else |
| syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell |
| if exists("c_no_comment_fold") |
| syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend |
| else |
| syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend |
| endif |
| endif |
| " keep a // comment separately, it terminates a preproc. conditional |
| syntax match cCommentError display "\*/" |
| syntax match cCommentStartError display "/\*"me=e-1 contained |
| |
| syn keyword cType int long short char void |
| syn keyword cType signed unsigned float double |
| if !exists("c_no_ansi") || exists("c_ansi_typedefs") |
| syn keyword cType size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t |
| syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t |
| syn keyword cType mbstate_t wctrans_t wint_t wctype_t |
| endif |
| if !exists("c_no_c99") " ISO C99 |
| syn keyword cType bool complex |
| syn keyword cType int8_t int16_t int32_t int64_t |
| syn keyword cType uint8_t uint16_t uint32_t uint64_t |
| syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t |
| syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t |
| syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t |
| syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t |
| syn keyword cType intptr_t uintptr_t |
| syn keyword cType intmax_t uintmax_t |
| endif |
| " syn keyword cStructure struct union enum typedef |
| |
| syn keyword cType args status action_name async_queue has priority |
| |
| |
| " Define the default highlighting. |
| " Only used when an item doesn't have highlighting yet |
| hi def link cFormat cSpecial |
| hi def link cCppString cString |
| hi def link cCommentL cComment |
| hi def link cCommentStart cComment |
| hi def link cLabel Label |
| hi def link cUserLabel Label |
| hi def link cConditional Conditional |
| hi def link cRepeat Repeat |
| hi def link cCharacter Character |
| hi def link cSpecialCharacter cSpecial |
| hi def link cNumber Number |
| hi def link cOctal Number |
| hi def link cOctalZero PreProc " link this to Error if you want |
| hi def link cFloat Float |
| hi def link cOctalError cError |
| hi def link cParenError cError |
| hi def link cErrInParen cError |
| hi def link cErrInBracket cError |
| hi def link cCommentError cError |
| hi def link cCommentStartError cError |
| hi def link cSpaceError cError |
| hi def link cSpecialError cError |
| hi def link cCurlyError cError |
| hi def link cOperator Operator |
| hi def link cStructure Structure |
| hi def link cStorageClass StorageClass |
| hi def link cInclude Include |
| hi def link cPreProc PreProc |
| hi def link cDefine Macro |
| hi def link cIncluded cString |
| hi def link cError Error |
| hi def link cStatement Statement |
| hi def link cPreCondit PreCondit |
| hi def link cType Type |
| hi def link cConstant Constant |
| hi def link cCommentString cString |
| hi def link cComment2String cString |
| hi def link cCommentSkip cComment |
| hi def link cString String |
| hi def link cComment Comment |
| hi def link cSpecial SpecialChar |
| hi def link cTodo Todo |
| hi def link cBadContinuation Error |
| hi def link cCppSkip cCppOut |
| hi def link cCppOut2 cCppOut |
| hi def link cCppOut Comment |
| |
| let b:current_syntax = "act" |
| |
| " vim: ts=8 |