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