Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Slice (ZeroC's Specification Language for Ice) |
| 3 | " Maintainer: Morel Bodin <bodin@tuxfamily.net> |
| 4 | " Last Change: 2003 Sep 24 |
| 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | " The Slice keywords |
| 15 | |
| 16 | syn keyword sliceType bool byte double float int long short string void |
| 17 | syn keyword sliceQualifier const extends idempotent implements local nonmutating out throws |
| 18 | syn keyword sliceConstruct class enum exception dictionnary interface module LocalObject Object sequence struct |
| 19 | syn keyword sliceQualifier const extends idempotent implements local nonmutating out throws |
| 20 | syn keyword sliceBoolean false true |
| 21 | |
| 22 | " Include directives |
| 23 | syn match sliceIncluded display contained "<[^>]*>" |
| 24 | syn match sliceInclude display "^\s*#\s*include\>\s*["<]" contains=sliceIncluded |
| 25 | |
| 26 | " Double-include guards |
| 27 | syn region sliceGuard start="^#\(define\|ifndef\|endif\)" end="$" |
| 28 | |
| 29 | " Strings and characters |
| 30 | syn region sliceString start=+"+ end=+"+ |
| 31 | |
| 32 | " Numbers (shamelessly ripped from c.vim, only slightly modified) |
| 33 | "integer number, or floating point number without a dot and with "f". |
| 34 | syn case ignore |
| 35 | syn match sliceNumbers display transparent "\<\d\|\.\d" contains=sliceNumber,sliceFloat,sliceOctal |
| 36 | syn match sliceNumber display contained "\d\+" |
| 37 | "hex number |
| 38 | syn match sliceNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" |
| 39 | " Flag the first zero of an octal number as something special |
| 40 | syn match sliceOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=sliceOctalZero |
| 41 | syn match sliceOctalZero display contained "\<0" |
| 42 | syn match sliceFloat display contained "\d\+f" |
| 43 | "floating point number, with dot, optional exponent |
| 44 | syn match sliceFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" |
| 45 | "floating point number, starting with a dot, optional exponent |
| 46 | syn match sliceFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" |
| 47 | "floating point number, without dot, with exponent |
| 48 | syn match sliceFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>" |
| 49 | " flag an octal number with wrong digits |
| 50 | syn case match |
| 51 | |
| 52 | |
| 53 | " Comments |
| 54 | syn region sliceComment start="/\*" end="\*/" |
| 55 | syn match sliceComment "//.*" |
| 56 | |
| 57 | syn sync ccomment sliceComment |
| 58 | |
| 59 | " Define the default highlighting. |
| 60 | " For version 5.7 and earlier: only when not done already |
| 61 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 62 | if version >= 508 || !exists("did_slice_syn_inits") |
| 63 | if version < 508 |
| 64 | let did_slice_syn_inits = 1 |
| 65 | command -nargs=+ HiLink hi link <args> |
| 66 | else |
| 67 | command -nargs=+ HiLink hi def link <args> |
| 68 | endif |
| 69 | |
| 70 | HiLink sliceComment Comment |
| 71 | HiLink sliceConstruct Keyword |
| 72 | HiLink sliceType Type |
| 73 | HiLink sliceString String |
| 74 | HiLink sliceIncluded String |
| 75 | HiLink sliceQualifier Keyword |
| 76 | HiLink sliceInclude Include |
| 77 | HiLink sliceGuard PreProc |
| 78 | HiLink sliceBoolean Boolean |
| 79 | HiLink sliceFloat Number |
| 80 | HiLink sliceNumber Number |
| 81 | HiLink sliceOctal Number |
| 82 | HiLink sliceOctalZero Special |
| 83 | HiLink sliceNumberError Special |
| 84 | |
| 85 | delcommand HiLink |
| 86 | endif |
| 87 | |
| 88 | let b:current_syntax = "slice" |
| 89 | |
| 90 | " vim: ts=8 |