1" Vim syntax file 2" Language: CSP (Communication Sequential Processes, using FDR input syntax) 3" Maintainer: Jan Bredereke <[email protected]> 4" Version: 0.6.0 5" Last change: Mon Mar 25, 2002 6" URL: http://www.tzi.de/~brederek/vim/ 7" Copying: You may distribute and use this file freely, in the same 8" way as the vim editor itself. 9" 10" To Do: - Probably I missed some keywords or operators, please 11" fix them and notify me, the maintainer. 12" - Currently, we do lexical highlighting only. It would be 13" nice to have more actual syntax checks, including 14" highlighting of wrong syntax. 15" - The additional syntax for the RT-Tester (pseudo-comments) 16" should be optional. 17 18" quit when a syntax file was already loaded 19if exists("b:current_syntax") 20 finish 21endif 22 23" case is significant to FDR: 24syn case match 25 26" Block comments in CSP are between {- and -} 27syn region cspComment start="{-" end="-}" contains=cspTodo 28" Single-line comments start with -- 29syn region cspComment start="--" end="$" contains=cspTodo,cspOldRttComment,cspSdlRttComment keepend 30 31" Numbers: 32syn match cspNumber "\<\d\+\>" 33 34" Conditionals: 35syn keyword cspConditional if then else 36 37" Operators on processes: 38" -> ? : ! ' ; /\ \ [] |~| [> & [[..<-..]] ||| [|..|] || [..<->..] ; : @ ||| 39syn match cspOperator "->" 40syn match cspOperator "/\\" 41syn match cspOperator "[^/]\\"lc=1 42syn match cspOperator "\[\]" 43syn match cspOperator "|\~|" 44syn match cspOperator "\[>" 45syn match cspOperator "\[\[" 46syn match cspOperator "\]\]" 47syn match cspOperator "<-" 48syn match cspOperator "|||" 49syn match cspOperator "[^|]||[^|]"lc=1,me=e-1 50syn match cspOperator "[^|{\~]|[^|}\~]"lc=1,me=e-1 51syn match cspOperator "\[|" 52syn match cspOperator "|\]" 53syn match cspOperator "\[[^>]"me=e-1 54syn match cspOperator "\]" 55syn match cspOperator "<->" 56syn match cspOperator "[?:!';@]" 57syn match cspOperator "&" 58syn match cspOperator "\." 59 60" (not on processes:) 61" syn match cspDelimiter "{|" 62" syn match cspDelimiter "|}" 63" syn match cspDelimiter "{[^-|]"me=e-1 64" syn match cspDelimiter "[^-|]}"lc=1 65 66" Keywords: 67syn keyword cspKeyword length null head tail concat elem 68syn keyword cspKeyword union inter diff Union Inter member card 69syn keyword cspKeyword empty set Set Seq 70syn keyword cspKeyword true false and or not within let 71syn keyword cspKeyword nametype datatype diamond normal 72syn keyword cspKeyword sbisim tau_loop_factor model_compress 73syn keyword cspKeyword explicate 74syn match cspKeyword "transparent" 75syn keyword cspKeyword external chase prioritize 76syn keyword cspKeyword channel Events 77syn keyword cspKeyword extensions productions 78syn keyword cspKeyword Bool Int 79 80" Reserved keywords: 81syn keyword cspReserved attribute embed module subtype 82 83" Include: 84syn region cspInclude matchgroup=cspIncludeKeyword start="^include" end="$" keepend contains=cspIncludeArg 85syn region cspIncludeArg start='\s\+\"' end= '\"\s*' contained 86 87" Assertions: 88syn keyword cspAssert assert deterministic divergence free deadlock 89syn keyword cspAssert livelock 90syn match cspAssert "\[T=" 91syn match cspAssert "\[F=" 92syn match cspAssert "\[FD=" 93syn match cspAssert "\[FD\]" 94syn match cspAssert "\[F\]" 95 96" Types and Sets 97" (first char a capital, later at least one lower case, no trailing underscore): 98syn match cspType "\<_*[A-Z][A-Z_0-9]*[a-z]\(\|[A-Za-z_0-9]*[A-Za-z0-9]\)\>" 99 100" Processes (all upper case, no trailing underscore): 101" (For identifiers that could be types or sets, too, this second rule set 102" wins.) 103syn match cspProcess "\<[A-Z_][A-Z_0-9]*[A-Z0-9]\>" 104syn match cspProcess "\<[A-Z_]\>" 105 106" reserved identifiers for tool output (ending in underscore): 107syn match cspReservedIdentifier "\<[A-Za-z_][A-Za-z_0-9]*_\>" 108 109" ToDo markers: 110syn match cspTodo "FIXME" contained 111syn match cspTodo "TODO" contained 112syn match cspTodo "!!!" contained 113 114" RT-Tester pseudo comments: 115" (The now obsolete syntax:) 116syn match cspOldRttComment "^--\$\$AM_UNDEF"lc=2 contained 117syn match cspOldRttComment "^--\$\$AM_ERROR"lc=2 contained 118syn match cspOldRttComment "^--\$\$AM_WARNING"lc=2 contained 119syn match cspOldRttComment "^--\$\$AM_SET_TIMER"lc=2 contained 120syn match cspOldRttComment "^--\$\$AM_RESET_TIMER"lc=2 contained 121syn match cspOldRttComment "^--\$\$AM_ELAPSED_TIMER"lc=2 contained 122syn match cspOldRttComment "^--\$\$AM_OUTPUT"lc=2 contained 123syn match cspOldRttComment "^--\$\$AM_INPUT"lc=2 contained 124" (The current syntax:) 125syn region cspRttPragma matchgroup=cspRttPragmaKeyword start="^pragma\s\+" end="\s*$" oneline keepend contains=cspRttPragmaArg,cspRttPragmaSdl 126syn keyword cspRttPragmaArg AM_ERROR AM_WARNING AM_SET_TIMER contained 127syn keyword cspRttPragmaArg AM_RESET_TIMER AM_ELAPSED_TIMER contained 128syn keyword cspRttPragmaArg AM_OUTPUT AM_INPUT AM_INTERNAL contained 129" the "SDL_MATCH" extension: 130syn region cspRttPragmaSdl matchgroup=cspRttPragmaKeyword start="SDL_MATCH\s\+" end="\s*$" contains=cspRttPragmaSdlArg contained 131syn keyword cspRttPragmaSdlArg TRANSLATE nextgroup=cspRttPragmaSdlTransName contained 132syn keyword cspRttPragmaSdlArg PARAM SKIP OPTIONAL CHOICE ARRAY nextgroup=cspRttPragmaSdlName contained 133syn match cspRttPragmaSdlName "\s*\S\+\s*" nextgroup=cspRttPragmaSdlTail contained 134syn region cspRttPragmaSdlTail start="" end="\s*$" contains=cspRttPragmaSdlTailArg contained 135syn keyword cspRttPragmaSdlTailArg SUBSET_USED DEFAULT_VALUE Present contained 136syn match cspRttPragmaSdlTransName "\s*\w\+\s*" nextgroup=cspRttPragmaSdlTransTail contained 137syn region cspRttPragmaSdlTransTail start="" end="\s*$" contains=cspRttPragmaSdlTransTailArg contained 138syn keyword cspRttPragmaSdlTransTailArg sizeof contained 139syn match cspRttPragmaSdlTransTailArg "\*" contained 140syn match cspRttPragmaSdlTransTailArg "(" contained 141syn match cspRttPragmaSdlTransTailArg ")" contained 142 143" temporary syntax extension for commented-out "pragma SDL_MATCH": 144syn match cspSdlRttComment "pragma\s\+SDL_MATCH\s\+" nextgroup=cspRttPragmaSdlArg contained 145 146syn sync lines=250 147 148" Define the default highlighting. 149" Only when an item doesn't have highlighting yet 150 151" The default methods for highlighting. Can be overridden later 152" (For vim version <=5.7, the command groups are defined in 153" $VIMRUNTIME/syntax/synload.vim ) 154hi def link cspComment Comment 155hi def link cspNumber Number 156hi def link cspConditional Conditional 157hi def link cspOperator Delimiter 158hi def link cspKeyword Keyword 159hi def link cspReserved SpecialChar 160hi def link cspInclude Error 161hi def link cspIncludeKeyword Include 162hi def link cspIncludeArg Include 163hi def link cspAssert PreCondit 164hi def link cspType Type 165hi def link cspProcess Function 166hi def link cspTodo Todo 167hi def link cspOldRttComment Define 168hi def link cspRttPragmaKeyword Define 169hi def link cspSdlRttComment Define 170hi def link cspRttPragmaArg Define 171hi def link cspRttPragmaSdlArg Define 172hi def link cspRttPragmaSdlName Default 173hi def link cspRttPragmaSdlTailArg Define 174hi def link cspRttPragmaSdlTransName Default 175hi def link cspRttPragmaSdlTransTailArg Define 176hi def link cspReservedIdentifier Error 177" (Currently unused vim method: Debug) 178 179 180let b:current_syntax = "csp" 181 182" vim: ts=8 183