csp.vim (7152B)
1 " Vim syntax file 2 " Language: CSP (Communication Sequential Processes, using FDR input syntax) 3 " Maintainer: Jan Bredereke <brederek@tzi.de> 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 19 if exists("b:current_syntax") 20 finish 21 endif 22 23 " case is significant to FDR: 24 syn case match 25 26 " Block comments in CSP are between {- and -} 27 syn region cspComment start="{-" end="-}" contains=cspTodo 28 " Single-line comments start with -- 29 syn region cspComment start="--" end="$" contains=cspTodo,cspOldRttComment,cspSdlRttComment keepend 30 31 " Numbers: 32 syn match cspNumber "\<\d\+\>" 33 34 " Conditionals: 35 syn keyword cspConditional if then else 36 37 " Operators on processes: 38 " -> ? : ! ' ; /\ \ [] |~| [> & [[..<-..]] ||| [|..|] || [..<->..] ; : @ ||| 39 syn match cspOperator "->" 40 syn match cspOperator "/\\" 41 syn match cspOperator "[^/]\\"lc=1 42 syn match cspOperator "\[\]" 43 syn match cspOperator "|\~|" 44 syn match cspOperator "\[>" 45 syn match cspOperator "\[\[" 46 syn match cspOperator "\]\]" 47 syn match cspOperator "<-" 48 syn match cspOperator "|||" 49 syn match cspOperator "[^|]||[^|]"lc=1,me=e-1 50 syn match cspOperator "[^|{\~]|[^|}\~]"lc=1,me=e-1 51 syn match cspOperator "\[|" 52 syn match cspOperator "|\]" 53 syn match cspOperator "\[[^>]"me=e-1 54 syn match cspOperator "\]" 55 syn match cspOperator "<->" 56 syn match cspOperator "[?:!';@]" 57 syn match cspOperator "&" 58 syn 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: 67 syn keyword cspKeyword length null head tail concat elem 68 syn keyword cspKeyword union inter diff Union Inter member card 69 syn keyword cspKeyword empty set Set Seq 70 syn keyword cspKeyword true false and or not within let 71 syn keyword cspKeyword nametype datatype diamond normal 72 syn keyword cspKeyword sbisim tau_loop_factor model_compress 73 syn keyword cspKeyword explicate 74 syn match cspKeyword "transparent" 75 syn keyword cspKeyword external chase prioritize 76 syn keyword cspKeyword channel Events 77 syn keyword cspKeyword extensions productions 78 syn keyword cspKeyword Bool Int 79 80 " Reserved keywords: 81 syn keyword cspReserved attribute embed module subtype 82 83 " Include: 84 syn region cspInclude matchgroup=cspIncludeKeyword start="^include" end="$" keepend contains=cspIncludeArg 85 syn region cspIncludeArg start='\s\+\"' end= '\"\s*' contained 86 87 " Assertions: 88 syn keyword cspAssert assert deterministic divergence free deadlock 89 syn keyword cspAssert livelock 90 syn match cspAssert "\[T=" 91 syn match cspAssert "\[F=" 92 syn match cspAssert "\[FD=" 93 syn match cspAssert "\[FD\]" 94 syn match cspAssert "\[F\]" 95 96 " Types and Sets 97 " (first char a capital, later at least one lower case, no trailing underscore): 98 syn 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.) 103 syn match cspProcess "\<[A-Z_][A-Z_0-9]*[A-Z0-9]\>" 104 syn match cspProcess "\<[A-Z_]\>" 105 106 " reserved identifiers for tool output (ending in underscore): 107 syn match cspReservedIdentifier "\<[A-Za-z_][A-Za-z_0-9]*_\>" 108 109 " ToDo markers: 110 syn match cspTodo "FIXME" contained 111 syn match cspTodo "TODO" contained 112 syn match cspTodo "!!!" contained 113 114 " RT-Tester pseudo comments: 115 " (The now obsolete syntax:) 116 syn match cspOldRttComment "^--\$\$AM_UNDEF"lc=2 contained 117 syn match cspOldRttComment "^--\$\$AM_ERROR"lc=2 contained 118 syn match cspOldRttComment "^--\$\$AM_WARNING"lc=2 contained 119 syn match cspOldRttComment "^--\$\$AM_SET_TIMER"lc=2 contained 120 syn match cspOldRttComment "^--\$\$AM_RESET_TIMER"lc=2 contained 121 syn match cspOldRttComment "^--\$\$AM_ELAPSED_TIMER"lc=2 contained 122 syn match cspOldRttComment "^--\$\$AM_OUTPUT"lc=2 contained 123 syn match cspOldRttComment "^--\$\$AM_INPUT"lc=2 contained 124 " (The current syntax:) 125 syn region cspRttPragma matchgroup=cspRttPragmaKeyword start="^pragma\s\+" end="\s*$" oneline keepend contains=cspRttPragmaArg,cspRttPragmaSdl 126 syn keyword cspRttPragmaArg AM_ERROR AM_WARNING AM_SET_TIMER contained 127 syn keyword cspRttPragmaArg AM_RESET_TIMER AM_ELAPSED_TIMER contained 128 syn keyword cspRttPragmaArg AM_OUTPUT AM_INPUT AM_INTERNAL contained 129 " the "SDL_MATCH" extension: 130 syn region cspRttPragmaSdl matchgroup=cspRttPragmaKeyword start="SDL_MATCH\s\+" end="\s*$" contains=cspRttPragmaSdlArg contained 131 syn keyword cspRttPragmaSdlArg TRANSLATE nextgroup=cspRttPragmaSdlTransName contained 132 syn keyword cspRttPragmaSdlArg PARAM SKIP OPTIONAL CHOICE ARRAY nextgroup=cspRttPragmaSdlName contained 133 syn match cspRttPragmaSdlName "\s*\S\+\s*" nextgroup=cspRttPragmaSdlTail contained 134 syn region cspRttPragmaSdlTail start="" end="\s*$" contains=cspRttPragmaSdlTailArg contained 135 syn keyword cspRttPragmaSdlTailArg SUBSET_USED DEFAULT_VALUE Present contained 136 syn match cspRttPragmaSdlTransName "\s*\w\+\s*" nextgroup=cspRttPragmaSdlTransTail contained 137 syn region cspRttPragmaSdlTransTail start="" end="\s*$" contains=cspRttPragmaSdlTransTailArg contained 138 syn keyword cspRttPragmaSdlTransTailArg sizeof contained 139 syn match cspRttPragmaSdlTransTailArg "\*" contained 140 syn match cspRttPragmaSdlTransTailArg "(" contained 141 syn match cspRttPragmaSdlTransTailArg ")" contained 142 143 " temporary syntax extension for commented-out "pragma SDL_MATCH": 144 syn match cspSdlRttComment "pragma\s\+SDL_MATCH\s\+" nextgroup=cspRttPragmaSdlArg contained 145 146 syn 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 ) 154 hi def link cspComment Comment 155 hi def link cspNumber Number 156 hi def link cspConditional Conditional 157 hi def link cspOperator Delimiter 158 hi def link cspKeyword Keyword 159 hi def link cspReserved SpecialChar 160 hi def link cspInclude Error 161 hi def link cspIncludeKeyword Include 162 hi def link cspIncludeArg Include 163 hi def link cspAssert PreCondit 164 hi def link cspType Type 165 hi def link cspProcess Function 166 hi def link cspTodo Todo 167 hi def link cspOldRttComment Define 168 hi def link cspRttPragmaKeyword Define 169 hi def link cspSdlRttComment Define 170 hi def link cspRttPragmaArg Define 171 hi def link cspRttPragmaSdlArg Define 172 hi def link cspRttPragmaSdlName Default 173 hi def link cspRttPragmaSdlTailArg Define 174 hi def link cspRttPragmaSdlTransName Default 175 hi def link cspRttPragmaSdlTransTailArg Define 176 hi def link cspReservedIdentifier Error 177 " (Currently unused vim method: Debug) 178 179 180 let b:current_syntax = "csp" 181 182 " vim: ts=8