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