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