3 " Copyright: Fred Barnes <frmb2@kent.ac.uk>, Mario Schweigler <ms44@kent.ac.uk>
4 " Maintainer: Mario Schweigler <ms44@kent.ac.uk>
5 " Last Change: 24 May 2003
9 elseif exists("b:current_syntax")
14 " Set shift width for indent
16 " Set the tab key size to two spaces
17 setlocal softtabstop=2
18 " Let tab keys always be expanded to spaces
21 " Dots are valid in occam identifiers
27 syn keyword occamType BYTE BOOL INT INT16 INT32 INT64 REAL32 REAL64 ANY
28 syn keyword occamType CHAN DATA OF TYPE TIMER INITIAL VAL PORT MOBILE PLACED
29 syn keyword occamType PROCESSOR PACKED RECORD PROTOCOL SHARED ROUND TRUNC
31 syn keyword occamStructure SEQ PAR IF ALT PRI FORKING PLACE AT
33 syn keyword occamKeyword PROC IS TRUE FALSE SIZE RECURSIVE REC
34 syn keyword occamKeyword RETYPES RESHAPES STEP FROM FOR RESCHEDULE STOP SKIP FORK
35 syn keyword occamKeyword FUNCTION VALOF RESULT ELSE CLONE CLAIM
36 syn keyword occamBoolean TRUE FALSE
37 syn keyword occamRepeat WHILE
38 syn keyword occamConditional CASE
39 syn keyword occamConstant MOSTNEG MOSTPOS
41 syn match occamBrackets /\[\|\]/
42 syn match occamParantheses /(\|)/
44 syn keyword occamOperator AFTER TIMES MINUS PLUS INITIAL REM AND OR XOR NOT
45 syn keyword occamOperator BITAND BITOR BITNOT BYTESIN OFFSETOF
47 syn match occamOperator /::\|:=\|?\|!/
48 syn match occamOperator /<\|>\|+\|-\|\*\|\/\|\\\|=\|\~/
49 syn match occamOperator /@\|\$\$\|%\|&&\|<&\|&>\|<\]\|\[>\|\^/
51 syn match occamSpecialChar /\M**\|*'\|*"\|*#\(\[0-9A-F\]\+\)/ contained
52 syn match occamChar /\M\L\='\[^*\]'/
53 syn match occamChar /L'[^']*'/ contains=occamSpecialChar
56 syn match occamTodo /\<todo\>:\=/ contained
57 syn match occamNote /\<note\>:\=/ contained
59 syn keyword occamNote NOT contained
61 syn match occamComment /--.*/ contains=occamCommentTitle,occamTodo,occamNote
62 syn match occamCommentTitle /--\s*\u\a*\(\s\+\u\a*\)*:/hs=s+2 contained contains=occamTodo,occamNote
63 syn match occamCommentTitle /--\s*KROC-LIBRARY\(\.so\|\.a\)\=\s*$/hs=s+2 contained
64 syn match occamCommentTitle /--\s*\(KROC-OPTIONS:\|RUN-PARAMETERS:\)/hs=s+2 contained
66 syn match occamIdentifier /\<[A-Z.][A-Z.0-9]*\>/
67 syn match occamFunction /\<[A-Za-z.][A-Za-z0-9.]*\>/ contained
69 syn match occamPPIdentifier /##.\{-}\>/
71 syn region occamString start=/"/ skip=/\M*"/ end=/"/ contains=occamSpecialChar
72 syn region occamCharString start=/'/ end=/'/ contains=occamSpecialChar
74 syn match occamNumber /\<\d\+\(\.\d\+\(E\(+\|-\)\d\+\)\=\)\=/
75 syn match occamNumber /-\d\+\(\.\d\+\(E\(+\|-\)\d\+\)\=\)\=/
76 syn match occamNumber /#\(\d\|[A-F]\)\+/
77 syn match occamNumber /-#\(\d\|[A-F]\)\+/
79 syn keyword occamCDString SHARED EXTERNAL DEFINED NOALIAS NOUSAGE NOT contained
80 syn keyword occamCDString FILE LINE PROCESS.PRIORITY OCCAM2.5 contained
81 syn keyword occamCDString USER.DEFINED.OPERATORS INITIAL.DECL MOBILES contained
82 syn keyword occamCDString BLOCKING.SYSCALLS VERSION NEED.QUAD.ALIGNMENT contained
83 syn keyword occamCDString TARGET.CANONICAL TARGET.CPU TARGET.OS TARGET.VENDOR contained
84 syn keyword occamCDString TRUE FALSE AND OR contained
85 syn match occamCDString /<\|>\|=\|(\|)/ contained
87 syn region occamCDirective start=/#\(USE\|INCLUDE\|PRAGMA\|DEFINE\|UNDEFINE\|UNDEF\|IF\|ELIF\|ELSE\|ENDIF\|WARNING\|ERROR\|RELAX\)\>/ end=/$/ contains=occamString,occamComment,occamCDString
89 if version >= 508 || !exists("did_occam_syn_inits")
91 let did_occam_syntax_inits = 1
92 command -nargs=+ HiLink hi link <args>
94 command -nargs=+ HiLink hi def link <args>
98 HiLink occamKeyword Keyword
99 HiLink occamComment Comment
100 HiLink occamCommentTitle PreProc
101 HiLink occamTodo Todo
102 HiLink occamNote Todo
103 HiLink occamString String
104 HiLink occamCharString String
105 HiLink occamNumber Number
106 HiLink occamCDirective PreProc
107 HiLink occamCDString String
108 HiLink occamPPIdentifier PreProc
109 HiLink occamBoolean Boolean
110 HiLink occamSpecialChar SpecialChar
111 HiLink occamChar Character
112 HiLink occamStructure Structure
113 HiLink occamIdentifier Identifier
114 HiLink occamConstant Constant
115 HiLink occamOperator Operator
116 HiLink occamFunction Ignore
117 HiLink occamRepeat Repeat
118 HiLink occamConditional Conditional
119 HiLink occamBrackets Type
120 HiLink occamParantheses Delimiter
125 let b:current_syntax = "occam"