blob: b541ac222951a39fa498c02442e7e6cb42286348 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001" Vim syntax file
2" Language: ACT c generation lang
3" Maintainer: FRC Team 971 <spartanrobotics.org>
4" Last Change: sometime
5
6" Quit when a (custom) syntax file was already loaded
7if exists("b:current_syntax")
8 finish
9endif
10
11syn keyword cTodo contained TODO FIXME XXX
12
13" It's easy to accidentally add a space after a backslash that was intended
14" for line continuation. Some compilers allow it, which makes it
15" unpredicatable and should be avoided.
16syn match cBadContinuation contained "\\\s\+$"
17
18" cCommentGroup allows adding matches for special things in comments
19syn cluster cCommentGroup contains=cTodo,cBadContinuation
20
21" This should be before cErrInParen to avoid problems with #define ({ xxx })
22if exists("c_curly_error")
23 syntax match cCurlyError "}"
24 syntax region cBlock start="{" end="}" contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold
25else
26 syntax region cBlock start="{" end="}" transparent fold
27endif
28
29
30
31if exists("c_comment_strings")
32 " A comment can contain cString, cCharacter and cNumber.
33 " But a "*/" inside a cString in a cComment DOES end the comment! So we
34 " need to use a special type of cString: cCommentString, which also ends on
35 " "*/", and sees a "*" at the start of the line as comment again.
36 " Unfortunately this doesn't very well work for // type of comments :-(
37 syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
38 syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
39 syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
40 syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
41 if exists("c_no_comment_fold")
42 " Use "extend" here to have preprocessor lines not terminate halfway a
43 " comment.
44 syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
45 else
46 syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
47 endif
48else
49 syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
50 if exists("c_no_comment_fold")
51 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend
52 else
53 syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend
54 endif
55endif
56" keep a // comment separately, it terminates a preproc. conditional
57syntax match cCommentError display "\*/"
58syntax match cCommentStartError display "/\*"me=e-1 contained
59
60syn keyword cType int long short char void
61syn keyword cType signed unsigned float double
62if !exists("c_no_ansi") || exists("c_ansi_typedefs")
63 syn keyword cType size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t
64 syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t
65 syn keyword cType mbstate_t wctrans_t wint_t wctype_t
66endif
67if !exists("c_no_c99") " ISO C99
68 syn keyword cType bool complex
69 syn keyword cType int8_t int16_t int32_t int64_t
70 syn keyword cType uint8_t uint16_t uint32_t uint64_t
71 syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
72 syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
73 syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
74 syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
75 syn keyword cType intptr_t uintptr_t
76 syn keyword cType intmax_t uintmax_t
77endif
78" syn keyword cStructure struct union enum typedef
79
80syn keyword cType args status action_name async_queue has priority
81
82
83" Define the default highlighting.
84" Only used when an item doesn't have highlighting yet
85hi def link cFormat cSpecial
86hi def link cCppString cString
87hi def link cCommentL cComment
88hi def link cCommentStart cComment
89hi def link cLabel Label
90hi def link cUserLabel Label
91hi def link cConditional Conditional
92hi def link cRepeat Repeat
93hi def link cCharacter Character
94hi def link cSpecialCharacter cSpecial
95hi def link cNumber Number
96hi def link cOctal Number
97hi def link cOctalZero PreProc " link this to Error if you want
98hi def link cFloat Float
99hi def link cOctalError cError
100hi def link cParenError cError
101hi def link cErrInParen cError
102hi def link cErrInBracket cError
103hi def link cCommentError cError
104hi def link cCommentStartError cError
105hi def link cSpaceError cError
106hi def link cSpecialError cError
107hi def link cCurlyError cError
108hi def link cOperator Operator
109hi def link cStructure Structure
110hi def link cStorageClass StorageClass
111hi def link cInclude Include
112hi def link cPreProc PreProc
113hi def link cDefine Macro
114hi def link cIncluded cString
115hi def link cError Error
116hi def link cStatement Statement
117hi def link cPreCondit PreCondit
118hi def link cType Type
119hi def link cConstant Constant
120hi def link cCommentString cString
121hi def link cComment2String cString
122hi def link cCommentSkip cComment
123hi def link cString String
124hi def link cComment Comment
125hi def link cSpecial SpecialChar
126hi def link cTodo Todo
127hi def link cBadContinuation Error
128hi def link cCppSkip cCppOut
129hi def link cCppOut2 cCppOut
130hi def link cCppOut Comment
131
132let b:current_syntax = "act"
133
134" vim: ts=8