1" Vim syntax file
2" Language:	splint (C with lclint/splint Annotations)
3" Maintainer:	Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4" Splint Home:	http://www.splint.org/
5" Last Change:	$Date: 2004/06/13 20:08:47 $
6" $Revision: 1.1 $
7
8" Note:		Splint annotated files are not detected by default.
9"		If you want to use this file for highlighting C code,
10"		please make sure splint.vim is sourced instead of c.vim,
11"		for example by putting
12"			/* vim: set filetype=splint : */
13"		at the end of your code or something like
14"			au! BufRead,BufNewFile *.c	setfiletype splint
15"		in your vimrc file or filetype.vim
16
17
18" For version 5.x: Clear all syntax items
19" For version 6.x: Quit when a syntax file was already loaded
20if version < 600
21  syntax clear
22elseif exists("b:current_syntax")
23  finish
24endif
25
26" Read the C syntax to start with
27if version < 600
28  so <sfile>:p:h/c.vim
29else
30  runtime! syntax/c.vim
31endif
32
33
34" FIXME: uses and changes several clusters defined in c.vim
35"	so watch for changes there
36
37" TODO: make a little more grammar explicit
38"	match flags with hyphen and underscore notation
39"	match flag expanded forms
40"	accept other comment char than @
41
42syn case match
43" splint annotations (taken from 'splint -help annotations')
44syn match   splintStateAnnot	contained "\(pre\|post\):\(only\|shared\|owned\|dependent\|observer\|exposed\|isnull\|notnull\)"
45syn keyword splintSpecialAnnot  contained special
46syn keyword splintSpecTag	contained uses sets defines allocated releases
47syn keyword splintModifies	contained modifies
48syn keyword splintRequires	contained requires ensures
49syn keyword splintGlobals	contained globals
50syn keyword splintGlobitem	contained internalState fileSystem
51syn keyword splintGlobannot	contained undef killed
52syn keyword splintWarning	contained warn
53
54syn keyword splintModitem	contained internalState fileSystem nothing
55syn keyword splintReqitem	contained MaxSet MaxRead result
56syn keyword splintIter		contained iter yield
57syn keyword splintConst		contained constant
58syn keyword splintAlt		contained alt
59
60syn keyword splintType		contained abstract concrete mutable immutable refcounted numabstract
61syn keyword splintGlobalType	contained unchecked checkmod checked checkedstrict
62syn keyword splintMemMgm	contained dependent keep killref only owned shared temp
63syn keyword splintAlias		contained unique returned
64syn keyword splintExposure	contained observer exposed
65syn keyword splintDefState	contained out in partial reldef
66syn keyword splintGlobState	contained undef killed
67syn keyword splintNullState	contained null notnull relnull
68syn keyword splintNullPred	contained truenull falsenull nullwhentrue falsewhennull
69syn keyword splintExit		contained exits mayexit trueexit falseexit neverexit
70syn keyword splintExec		contained noreturn maynotreturn noreturnwhentrue noreturnwhenfalse alwaysreturns
71syn keyword splintSef		contained sef
72syn keyword splintDecl		contained unused external
73syn keyword splintCase		contained fallthrough
74syn keyword splintBreak		contained innerbreak loopbreak switchbreak innercontinue
75syn keyword splintUnreach	contained notreached
76syn keyword splintSpecFunc	contained printflike scanflike messagelike
77
78" TODO: make these region or match
79syn keyword splintErrSupp	contained i ignore end t
80syn match   splintErrSupp	contained "[it]\d\+\>"
81syn keyword splintTypeAcc	contained access noaccess
82
83syn keyword splintMacro		contained notfunction
84syn match   splintSpecType	contained "\(\|unsigned\|signed\)integraltype"
85
86" Flags taken from 'splint -help flags full' divided in local and global flags
87"				 Local Flags:
88syn keyword splintFlag contained abstract abstractcompare accessall accessczech accessczechoslovak
89syn keyword splintFlag contained accessfile accessmodule accessslovak aliasunique allblock
90syn keyword splintFlag contained allempty allglobs allimponly allmacros alwaysexits
91syn keyword splintFlag contained annotationerror ansi89limits assignexpose badflag bitwisesigned
92syn keyword splintFlag contained boolcompare boolfalse boolint boolops booltrue
93syn keyword splintFlag contained booltype bounds boundscompacterrormessages boundsread boundswrite
94syn keyword splintFlag contained branchstate bufferoverflow bufferoverflowhigh bugslimit casebreak
95syn keyword splintFlag contained caseinsensitivefilenames castexpose castfcnptr charindex charint
96syn keyword splintFlag contained charintliteral charunsignedchar checkedglobalias checkmodglobalias checkpost
97syn keyword splintFlag contained checkstrictglobalias checkstrictglobs codeimponly commentchar commenterror
98syn keyword splintFlag contained compdef compdestroy compmempass constmacros constprefix
99syn keyword splintFlag contained constprefixexclude constuse continuecomment controlnestdepth cppnames
100syn keyword splintFlag contained csvoverwrite czech czechconsts czechfcns czechmacros
101syn keyword splintFlag contained czechoslovak czechoslovakconsts czechoslovakfcns czechoslovakmacros czechoslovaktypes
102syn keyword splintFlag contained czechoslovakvars czechtypes czechvars debugfcnconstraint declundef
103syn keyword splintFlag contained deepbreak deparrays dependenttrans distinctexternalnames distinctinternalnames
104syn keyword splintFlag contained duplicatecases duplicatequals elseifcomplete emptyret enumindex
105syn keyword splintFlag contained enumint enummembers enummemuse enumprefix enumprefixexclude
106syn keyword splintFlag contained evalorder evalorderuncon exitarg exportany exportconst
107syn keyword splintFlag contained exportfcn exportheader exportheadervar exportiter exportlocal
108syn keyword splintFlag contained exportmacro exporttype exportvar exposetrans externalnamecaseinsensitive
109syn keyword splintFlag contained externalnamelen externalprefix externalprefixexclude fcnderef fcnmacros
110syn keyword splintFlag contained fcnpost fcnuse fielduse fileextensions filestaticprefix
111syn keyword splintFlag contained filestaticprefixexclude firstcase fixedformalarray floatdouble forblock
112syn keyword splintFlag contained forcehints forempty forloopexec formalarray formatcode
113syn keyword splintFlag contained formatconst formattype forwarddecl freshtrans fullinitblock
114syn keyword splintFlag contained globalias globalprefix globalprefixexclude globimponly globnoglobs
115syn keyword splintFlag contained globs globsimpmodsnothing globstate globuse gnuextensions
116syn keyword splintFlag contained grammar hasyield hints htmlfileformat ifblock
117syn keyword splintFlag contained ifempty ignorequals ignoresigns immediatetrans impabstract
118syn keyword splintFlag contained impcheckedglobs impcheckedspecglobs impcheckedstatics impcheckedstrictglobs impcheckedstrictspecglobs
119syn keyword splintFlag contained impcheckedstrictstatics impcheckmodglobs impcheckmodinternals impcheckmodspecglobs impcheckmodstatics
120syn keyword splintFlag contained impconj implementationoptional implictconstraint impouts imptype
121syn keyword splintFlag contained includenest incompletetype incondefs incondefslib indentspaces
122syn keyword splintFlag contained infloops infloopsuncon initallelements initsize internalglobs
123syn keyword splintFlag contained internalglobsnoglobs internalnamecaseinsensitive internalnamelen internalnamelookalike iso99limits
124syn keyword splintFlag contained isoreserved isoreservedinternal iterbalance iterloopexec iterprefix
125syn keyword splintFlag contained iterprefixexclude iteryield its4low its4moderate its4mostrisky
126syn keyword splintFlag contained its4risky its4veryrisky keep keeptrans kepttrans
127syn keyword splintFlag contained legacy libmacros likelyboundsread likelyboundswrite likelybool
128syn keyword splintFlag contained likelybounds limit linelen lintcomments localprefix
129syn keyword splintFlag contained localprefixexclude locindentspaces longint longintegral longsignedintegral
130syn keyword splintFlag contained longunsignedintegral longunsignedunsignedintegral loopexec looploopbreak looploopcontinue
131syn keyword splintFlag contained loopswitchbreak macroassign macroconstdecl macrodecl macroempty
132syn keyword splintFlag contained macrofcndecl macromatchname macroparams macroparens macroredef
133syn keyword splintFlag contained macroreturn macrostmt macrounrecog macrovarprefix macrovarprefixexclude
134syn keyword splintFlag contained maintype matchanyintegral matchfields mayaliasunique memchecks
135syn keyword splintFlag contained memimp memtrans misplacedsharequal misscase modfilesys
136syn keyword splintFlag contained modglobs modglobsnomods modglobsunchecked modinternalstrict modnomods
137syn keyword splintFlag contained modobserver modobserveruncon mods modsimpnoglobs modstrictglobsnomods
138syn keyword splintFlag contained moduncon modunconnomods modunspec multithreaded mustdefine
139syn keyword splintFlag contained mustfree mustfreefresh mustfreeonly mustmod mustnotalias
140syn keyword splintFlag contained mutrep namechecks needspec nestcomment nestedextern
141syn keyword splintFlag contained newdecl newreftrans nextlinemacros noaccess nocomments
142syn keyword splintFlag contained noeffect noeffectuncon noparams nopp noret
143syn keyword splintFlag contained null nullassign nullderef nullinit nullpass
144syn keyword splintFlag contained nullptrarith nullret nullstate nullterminated
145syn keyword splintFlag contained numabstract numabstractcast numabstractindex numabstractlit numabstractprint
146syn keyword splintFlag contained numenummembers numliteral numstructfields observertrans obviousloopexec
147syn keyword splintFlag contained oldstyle onlytrans onlyunqglobaltrans orconstraint overload
148syn keyword splintFlag contained ownedtrans paramimptemp paramuse parenfileformat partial
149syn keyword splintFlag contained passunknown portability predassign predbool predboolint
150syn keyword splintFlag contained predboolothers predboolptr preproc protoparammatch protoparamname
151syn keyword splintFlag contained protoparamprefix protoparamprefixexclude ptrarith ptrcompare ptrnegate
152syn keyword splintFlag contained quiet readonlystrings readonlytrans realcompare redecl
153syn keyword splintFlag contained redef redundantconstraints redundantsharequal refcounttrans relaxquals
154syn keyword splintFlag contained relaxtypes repeatunrecog repexpose retalias retexpose
155syn keyword splintFlag contained retimponly retval retvalbool retvalint retvalother
156syn keyword splintFlag contained sefparams sefuncon shadow sharedtrans shiftimplementation
157syn keyword splintFlag contained shiftnegative shortint showallconjs showcolumn showconstraintlocation
158syn keyword splintFlag contained showconstraintparens showdeephistory showfunc showloadloc showscan
159syn keyword splintFlag contained showsourceloc showsummary sizeofformalarray sizeoftype skipisoheaders
160syn keyword splintFlag contained skipposixheaders slashslashcomment slovak slovakconsts slovakfcns
161syn keyword splintFlag contained slovakmacros slovaktypes slovakvars specglobimponly specimponly
162syn keyword splintFlag contained specmacros specretimponly specstructimponly specundecl specundef
163syn keyword splintFlag contained stackref statemerge statetransfer staticinittrans statictrans
164syn keyword splintFlag contained strictbranchstate strictdestroy strictops strictusereleased stringliterallen
165syn keyword splintFlag contained stringliteralnoroom stringliteralnoroomfinalnull stringliteralsmaller stringliteraltoolong structimponly
166syn keyword splintFlag contained superuser switchloopbreak switchswitchbreak syntax sysdirerrors
167syn keyword splintFlag contained sysdirexpandmacros sysunrecog tagprefix tagprefixexclude temptrans
168syn keyword splintFlag contained tmpcomments toctou topuse trytorecover type
169syn keyword splintFlag contained typeprefix typeprefixexclude typeuse uncheckedglobalias uncheckedmacroprefix
170syn keyword splintFlag contained uncheckedmacroprefixexclude uniondef unixstandard unqualifiedinittrans unqualifiedtrans
171syn keyword splintFlag contained unreachable unrecog unrecogcomments unrecogdirective unrecogflagcomments
172syn keyword splintFlag contained unsignedcompare unusedspecial usedef usereleased usevarargs
173syn keyword splintFlag contained varuse voidabstract warnflags warnlintcomments warnmissingglobs
174syn keyword splintFlag contained warnmissingglobsnoglobs warnposixheaders warnrc warnsysfiles warnunixlib
175syn keyword splintFlag contained warnuse whileblock whileempty whileloopexec zerobool
176syn keyword splintFlag contained zeroptr
177"				       Global Flags:
178syn keyword splintGlobalFlag contained csv dump errorstream errorstreamstderr errorstreamstdout
179syn keyword splintGlobalFlag contained expect f help i isolib
180syn keyword splintGlobalFlag contained larchpath lclexpect lclimportdir lcs lh
181syn keyword splintGlobalFlag contained load messagestream messagestreamstderr messagestreamstdout mts
182syn keyword splintGlobalFlag contained neverinclude nof nolib posixlib posixstrictlib
183syn keyword splintGlobalFlag contained showalluses singleinclude skipsysheaders stats streamoverwrite
184syn keyword splintGlobalFlag contained strictlib supcounts sysdirs timedist tmpdir
185syn keyword splintGlobalFlag contained unixlib unixstrictlib warningstream warningstreamstderr warningstreamstdout
186syn keyword splintGlobalFlag contained whichlib
187syn match   splintFlagExpr contained "[\+\-\=]" nextgroup=splintFlag,splintGlobalFlag
188
189" detect missing /*@ and wrong */
190syn match	splintAnnError	"@\*/"
191syn cluster	cCommentGroup	add=splintAnnError
192syn match	splintAnnError2	"[^@]\*/"hs=s+1 contained
193syn region	splintAnnotation start="/\*@" end="@\*/" contains=@splintAnnotElem,cType keepend
194syn match	splintShortAnn	"/\*@\*/"
195syn cluster	splintAnnotElem	contains=splintStateAnnot,splintSpecialAnnot,splintSpecTag,splintModifies,splintRequires,splintGlobals,splintGlobitem,splintGlobannot,splintWarning,splintModitem,splintIter,splintConst,splintAlt,splintType,splintGlobalType,splintMemMgm,splintAlias,splintExposure,splintDefState,splintGlobState,splintNullState,splintNullPred,splintExit,splintExec,splintSef,splintDecl,splintCase,splintBreak,splintUnreach,splintSpecFunc,splintErrSupp,splintTypeAcc,splintMacro,splintSpecType,splintAnnError2,splintFlagExpr
196syn cluster	splintAllStuff	contains=@splintAnnotElem,splintFlag,splintGlobalFlag
197syn cluster	cParenGroup	add=@splintAllStuff
198syn cluster	cPreProcGroup	add=@splintAllStuff
199syn cluster	cMultiGroup	add=@splintAllStuff
200
201" Define the default highlighting.
202" For version 5.7 and earlier: only when not done already
203" For version 5.8 and later: only when an item doesn't have highlighting yet
204if version >= 508 || !exists("did_splint_syntax_inits")
205  if version < 508
206    let did_splint_syntax_inits = 1
207    command -nargs=+ HiLink hi link <args>
208  else
209    command -nargs=+ HiLink hi def link <args>
210  endif
211
212  HiLink splintShortAnn		splintAnnotation
213  HiLink splintAnnotation	Comment
214  HiLink splintAnnError		splintError
215  HiLink splintAnnError2	splintError
216  HiLink splintFlag		SpecialComment
217  HiLink splintGlobalFlag	splintError
218  HiLink splintSpecialAnnot	splintAnnKey
219  HiLink splintStateAnnot	splintAnnKey
220  HiLink splintSpecTag		splintAnnKey
221  HiLink splintModifies		splintAnnKey
222  HiLink splintRequires		splintAnnKey
223  HiLink splintGlobals		splintAnnKey
224  HiLink splintGlobitem		Constant
225  HiLink splintGlobannot	splintAnnKey
226  HiLink splintWarning		splintAnnKey
227  HiLink splintModitem		Constant
228  HiLink splintIter		splintAnnKey
229  HiLink splintConst		splintAnnKey
230  HiLink splintAlt		splintAnnKey
231  HiLink splintType		splintAnnKey
232  HiLink splintGlobalType	splintAnnKey
233  HiLink splintMemMgm		splintAnnKey
234  HiLink splintAlias		splintAnnKey
235  HiLink splintExposure		splintAnnKey
236  HiLink splintDefState		splintAnnKey
237  HiLink splintGlobState	splintAnnKey
238  HiLink splintNullState	splintAnnKey
239  HiLink splintNullPred		splintAnnKey
240  HiLink splintExit		splintAnnKey
241  HiLink splintExec		splintAnnKey
242  HiLink splintSef		splintAnnKey
243  HiLink splintDecl		splintAnnKey
244  HiLink splintCase		splintAnnKey
245  HiLink splintBreak		splintAnnKey
246  HiLink splintUnreach		splintAnnKey
247  HiLink splintSpecFunc		splintAnnKey
248  HiLink splintErrSupp		splintAnnKey
249  HiLink splintTypeAcc		splintAnnKey
250  HiLink splintMacro		splintAnnKey
251  HiLink splintSpecType		splintAnnKey
252  HiLink splintAnnKey		Type
253  HiLink splintError		Error
254
255  delcommand HiLink
256endif
257
258let b:current_syntax = "splint"
259
260" vim: ts=8
261