blob: 01d139bd094a65a59efef87e3bdab2af4e6c885a [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: occam
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
6
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02007" quit when a syntax file was already loaded
8if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00009 finish
10endif
11
12"{{{ Settings
13" Set shift width for indent
14setlocal shiftwidth=2
15" Set the tab key size to two spaces
16setlocal softtabstop=2
17" Let tab keys always be expanded to spaces
18setlocal expandtab
19
20" Dots are valid in occam identifiers
21setlocal iskeyword+=.
22"}}}
23
24syn case match
25
26syn keyword occamType BYTE BOOL INT INT16 INT32 INT64 REAL32 REAL64 ANY
27syn keyword occamType CHAN DATA OF TYPE TIMER INITIAL VAL PORT MOBILE PLACED
28syn keyword occamType PROCESSOR PACKED RECORD PROTOCOL SHARED ROUND TRUNC
29
30syn keyword occamStructure SEQ PAR IF ALT PRI FORKING PLACE AT
31
32syn keyword occamKeyword PROC IS TRUE FALSE SIZE RECURSIVE REC
33syn keyword occamKeyword RETYPES RESHAPES STEP FROM FOR RESCHEDULE STOP SKIP FORK
34syn keyword occamKeyword FUNCTION VALOF RESULT ELSE CLONE CLAIM
35syn keyword occamBoolean TRUE FALSE
36syn keyword occamRepeat WHILE
37syn keyword occamConditional CASE
38syn keyword occamConstant MOSTNEG MOSTPOS
39
40syn match occamBrackets /\[\|\]/
41syn match occamParantheses /(\|)/
42
43syn keyword occamOperator AFTER TIMES MINUS PLUS INITIAL REM AND OR XOR NOT
44syn keyword occamOperator BITAND BITOR BITNOT BYTESIN OFFSETOF
45
46syn match occamOperator /::\|:=\|?\|!/
47syn match occamOperator /<\|>\|+\|-\|\*\|\/\|\\\|=\|\~/
48syn match occamOperator /@\|\$\$\|%\|&&\|<&\|&>\|<\]\|\[>\|\^/
49
50syn match occamSpecialChar /\M**\|*'\|*"\|*#\(\[0-9A-F\]\+\)/ contained
51syn match occamChar /\M\L\='\[^*\]'/
52syn match occamChar /L'[^']*'/ contains=occamSpecialChar
53
54syn case ignore
55syn match occamTodo /\<todo\>:\=/ contained
56syn match occamNote /\<note\>:\=/ contained
57syn case match
58syn keyword occamNote NOT contained
59
60syn match occamComment /--.*/ contains=occamCommentTitle,occamTodo,occamNote
61syn match occamCommentTitle /--\s*\u\a*\(\s\+\u\a*\)*:/hs=s+2 contained contains=occamTodo,occamNote
62syn match occamCommentTitle /--\s*KROC-LIBRARY\(\.so\|\.a\)\=\s*$/hs=s+2 contained
63syn match occamCommentTitle /--\s*\(KROC-OPTIONS:\|RUN-PARAMETERS:\)/hs=s+2 contained
64
65syn match occamIdentifier /\<[A-Z.][A-Z.0-9]*\>/
66syn match occamFunction /\<[A-Za-z.][A-Za-z0-9.]*\>/ contained
67
68syn match occamPPIdentifier /##.\{-}\>/
69
70syn region occamString start=/"/ skip=/\M*"/ end=/"/ contains=occamSpecialChar
71syn region occamCharString start=/'/ end=/'/ contains=occamSpecialChar
72
73syn match occamNumber /\<\d\+\(\.\d\+\(E\(+\|-\)\d\+\)\=\)\=/
74syn match occamNumber /-\d\+\(\.\d\+\(E\(+\|-\)\d\+\)\=\)\=/
75syn match occamNumber /#\(\d\|[A-F]\)\+/
76syn match occamNumber /-#\(\d\|[A-F]\)\+/
77
78syn keyword occamCDString SHARED EXTERNAL DEFINED NOALIAS NOUSAGE NOT contained
79syn keyword occamCDString FILE LINE PROCESS.PRIORITY OCCAM2.5 contained
80syn keyword occamCDString USER.DEFINED.OPERATORS INITIAL.DECL MOBILES contained
81syn keyword occamCDString BLOCKING.SYSCALLS VERSION NEED.QUAD.ALIGNMENT contained
82syn keyword occamCDString TARGET.CANONICAL TARGET.CPU TARGET.OS TARGET.VENDOR contained
83syn keyword occamCDString TRUE FALSE AND OR contained
84syn match occamCDString /<\|>\|=\|(\|)/ contained
85
86syn region occamCDirective start=/#\(USE\|INCLUDE\|PRAGMA\|DEFINE\|UNDEFINE\|UNDEF\|IF\|ELIF\|ELSE\|ENDIF\|WARNING\|ERROR\|RELAX\)\>/ end=/$/ contains=occamString,occamComment,occamCDString
87
Bram Moolenaar071d4272004-06-13 20:20:40 +000088
Bram Moolenaarf37506f2016-08-31 22:22:10 +020089hi def link occamType Type
90hi def link occamKeyword Keyword
91hi def link occamComment Comment
92hi def link occamCommentTitle PreProc
93hi def link occamTodo Todo
94hi def link occamNote Todo
95hi def link occamString String
96hi def link occamCharString String
97hi def link occamNumber Number
98hi def link occamCDirective PreProc
99hi def link occamCDString String
100hi def link occamPPIdentifier PreProc
101hi def link occamBoolean Boolean
102hi def link occamSpecialChar SpecialChar
103hi def link occamChar Character
104hi def link occamStructure Structure
105hi def link occamIdentifier Identifier
106hi def link occamConstant Constant
107hi def link occamOperator Operator
108hi def link occamFunction Ignore
109hi def link occamRepeat Repeat
110hi def link occamConditional Conditional
111hi def link occamBrackets Type
112hi def link occamParantheses Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000113
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114
115let b:current_syntax = "occam"
116