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 | |
| 7 | if version < 600 |
| 8 | syntax clear |
| 9 | elseif exists("b:current_syntax") |
| 10 | finish |
| 11 | endif |
| 12 | |
| 13 | "{{{ Settings |
| 14 | " Set shift width for indent |
| 15 | setlocal shiftwidth=2 |
| 16 | " Set the tab key size to two spaces |
| 17 | setlocal softtabstop=2 |
| 18 | " Let tab keys always be expanded to spaces |
| 19 | setlocal expandtab |
| 20 | |
| 21 | " Dots are valid in occam identifiers |
| 22 | setlocal iskeyword+=. |
| 23 | "}}} |
| 24 | |
| 25 | syn case match |
| 26 | |
| 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 |
| 30 | |
| 31 | syn keyword occamStructure SEQ PAR IF ALT PRI FORKING PLACE AT |
| 32 | |
| 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 |
| 40 | |
| 41 | syn match occamBrackets /\[\|\]/ |
| 42 | syn match occamParantheses /(\|)/ |
| 43 | |
| 44 | syn keyword occamOperator AFTER TIMES MINUS PLUS INITIAL REM AND OR XOR NOT |
| 45 | syn keyword occamOperator BITAND BITOR BITNOT BYTESIN OFFSETOF |
| 46 | |
| 47 | syn match occamOperator /::\|:=\|?\|!/ |
| 48 | syn match occamOperator /<\|>\|+\|-\|\*\|\/\|\\\|=\|\~/ |
| 49 | syn match occamOperator /@\|\$\$\|%\|&&\|<&\|&>\|<\]\|\[>\|\^/ |
| 50 | |
| 51 | syn match occamSpecialChar /\M**\|*'\|*"\|*#\(\[0-9A-F\]\+\)/ contained |
| 52 | syn match occamChar /\M\L\='\[^*\]'/ |
| 53 | syn match occamChar /L'[^']*'/ contains=occamSpecialChar |
| 54 | |
| 55 | syn case ignore |
| 56 | syn match occamTodo /\<todo\>:\=/ contained |
| 57 | syn match occamNote /\<note\>:\=/ contained |
| 58 | syn case match |
| 59 | syn keyword occamNote NOT contained |
| 60 | |
| 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 |
| 65 | |
| 66 | syn match occamIdentifier /\<[A-Z.][A-Z.0-9]*\>/ |
| 67 | syn match occamFunction /\<[A-Za-z.][A-Za-z0-9.]*\>/ contained |
| 68 | |
| 69 | syn match occamPPIdentifier /##.\{-}\>/ |
| 70 | |
| 71 | syn region occamString start=/"/ skip=/\M*"/ end=/"/ contains=occamSpecialChar |
| 72 | syn region occamCharString start=/'/ end=/'/ contains=occamSpecialChar |
| 73 | |
| 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]\)\+/ |
| 78 | |
| 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 |
| 86 | |
| 87 | syn region occamCDirective start=/#\(USE\|INCLUDE\|PRAGMA\|DEFINE\|UNDEFINE\|UNDEF\|IF\|ELIF\|ELSE\|ENDIF\|WARNING\|ERROR\|RELAX\)\>/ end=/$/ contains=occamString,occamComment,occamCDString |
| 88 | |
| 89 | if version >= 508 || !exists("did_occam_syn_inits") |
| 90 | if version < 508 |
| 91 | let did_occam_syntax_inits = 1 |
| 92 | command -nargs=+ HiLink hi link <args> |
| 93 | else |
| 94 | command -nargs=+ HiLink hi def link <args> |
| 95 | endif |
| 96 | |
| 97 | HiLink occamType Type |
| 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 |
| 121 | |
| 122 | delcommand HiLink |
| 123 | endif |
| 124 | |
| 125 | let b:current_syntax = "occam" |
| 126 | |