splint.vim 15 KB

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