Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: kimwitu++ |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 3 | " Maintainer: Michael Piefel <entwurf@piefel.de> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4 | " Last Change: 2 May 2001 |
| 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 | " Read the C++ syntax to start with |
| 15 | if version < 600 |
| 16 | source <sfile>:p:h/cpp.vim |
| 17 | else |
| 18 | runtime! syntax/cpp.vim |
| 19 | unlet b:current_syntax |
| 20 | endif |
| 21 | |
| 22 | " kimwitu++ extentions |
| 23 | |
| 24 | " Don't stop at eol, messes around with CPP mode, but gives line spanning |
| 25 | " strings in unparse rules |
| 26 | syn region cCppString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat |
| 27 | syn keyword cType integer real casestring nocasestring voidptr list |
| 28 | syn keyword cType uview rview uview_enum rview_enum |
| 29 | |
| 30 | " avoid unparsing rule sth:view being scanned as label |
| 31 | syn clear cUserCont |
| 32 | syn match cUserCont "^\s*\I\i*\s*:$" contains=cUserLabel contained |
| 33 | syn match cUserCont ";\s*\I\i*\s*:$" contains=cUserLabel contained |
| 34 | syn match cUserCont "^\s*\I\i*\s*:[^:]"me=e-1 contains=cUserLabel contained |
| 35 | syn match cUserCont ";\s*\I\i*\s*:[^:]"me=e-1 contains=cUserLabel contained |
| 36 | |
| 37 | " highlight phylum decls |
| 38 | syn match kwtPhylum "^\I\i*:$" |
| 39 | syn match kwtPhylum "^\I\i*\s*{\s*\(!\|\I\)\i*\s*}\s*:$" |
| 40 | |
| 41 | syn keyword kwtStatement with foreach afterforeach provided |
| 42 | syn match kwtDecl "%\(uviewvar\|rviewvar\)" |
| 43 | syn match kwtDecl "^%\(uview\|rview\|ctor\|dtor\|base\|storageclass\|list\|attr\|member\|option\)" |
| 44 | syn match kwtOption "no-csgio\|no-unparse\|no-rewrite\|no-printdot\|no-hashtables\|smart-pointer\|weak-pointer" |
| 45 | syn match kwtSep "^%}$" |
| 46 | syn match kwtSep "^%{\(\s\+\I\i*\)*$" |
| 47 | syn match kwtCast "\<phylum_cast\s*<"me=e-1 |
| 48 | syn match kwtCast "\<phylum_cast\s*$" |
| 49 | |
| 50 | |
| 51 | " match views, remove paren error in brackets |
| 52 | syn clear cErrInBracket |
| 53 | syn match cErrInBracket contained ")" |
| 54 | syn match kwtViews "\(\[\|<\)\@<=[ [:alnum:]_]\{-}:" |
| 55 | |
| 56 | " match rule bodies |
| 57 | syn region kwtUnpBody transparent keepend extend fold start="->\s*\[" start="^\s*\[" skip="\$\@<!{\_.\{-}\$\@<!}" end="\s]\s\=;\=$" end="^]\s\=;\=$" end="}]\s\=;\=$" |
| 58 | syn region kwtRewBody transparent keepend extend fold start="->\s*<" start="^\s*<" end="\s>\s\=;\=$" end="^>\s\=;\=$" |
| 59 | |
| 60 | " Define the default highlighting. |
| 61 | " For version 5.7 and earlier: only when not done already |
| 62 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 63 | if version >= 508 || !exists("did_kwt_syn_inits") |
| 64 | if version < 508 |
| 65 | let did_kwt_syn_inits = 1 |
| 66 | command -nargs=+ HiLink hi link <args> |
| 67 | else |
| 68 | command -nargs=+ HiLink hi def link <args> |
| 69 | endif |
| 70 | |
| 71 | HiLink kwtStatement cppStatement |
| 72 | HiLink kwtDecl cppStatement |
| 73 | HiLink kwtCast cppStatement |
| 74 | HiLink kwtSep Delimiter |
| 75 | HiLink kwtViews Label |
| 76 | HiLink kwtPhylum Type |
| 77 | HiLink kwtOption PreProc |
| 78 | "HiLink cText Comment |
| 79 | |
| 80 | delcommand HiLink |
| 81 | endif |
| 82 | |
| 83 | syn sync lines=300 |
| 84 | |
| 85 | let b:current_syntax = "kwt" |
| 86 | |
| 87 | " vim: ts=8 |