Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 1 | " Vim syntax file for the D programming language (version 1.053 and 2.047). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | " |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 3 | " Language: D |
| 4 | " Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com> |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 5 | " Last Change: 2012 Jan 11 |
| 6 | " Version: 0.24 |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 7 | " |
| 8 | " Contributors: |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 9 | " - Jason Mills <jasonmills@nf.sympatico.ca>: original Maintainer |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 10 | " - Kirk McDonald |
| 11 | " - Tim Keating |
| 12 | " - Frank Benoit |
| 13 | " - Shougo Matsushita <Shougo.Matsu@gmail.com> |
| 14 | " - Ellery Newcomer |
| 15 | " - Steven N. Oliver |
| 16 | " - Sohgo Takeuchi |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 17 | " |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 18 | " Please submit bugs/comments/suggestions to the github repo: |
| 19 | " https://github.com/he-the-great/d.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 20 | " |
| 21 | " Options: |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 22 | " d_comment_strings - Set to highlight strings and numbers in comments. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 23 | " |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 24 | " d_hl_operator_overload - Set to highlight D's specially named functions |
| 25 | " that when overloaded implement unary and binary operators (e.g. opCmp). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | " |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 27 | " d_hl_object_types - Set to highlight some common types from object.di. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | |
| 29 | " Quit when a syntax file was already loaded |
| 30 | if exists("b:current_syntax") |
| 31 | finish |
| 32 | endif |
| 33 | |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 34 | " Support cpoptions |
| 35 | let s:cpo_save = &cpo |
| 36 | set cpo&vim |
| 37 | |
| 38 | " Set the current syntax to be known as d |
| 39 | let b:current_syntax = "d" |
| 40 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 41 | " Keyword definitions |
| 42 | " |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 43 | syn keyword dExternal import module |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 44 | syn keyword dConditional if else switch |
| 45 | syn keyword dBranch goto break continue |
| 46 | syn keyword dRepeat while for do foreach foreach_reverse |
| 47 | syn keyword dBoolean true false |
| 48 | syn keyword dConstant null |
| 49 | syn keyword dConstant __FILE__ __LINE__ __EOF__ __VERSION__ |
| 50 | syn keyword dConstant __DATE__ __TIME__ __TIMESTAMP__ __VENDOR__ |
| 51 | syn keyword dTypedef alias typedef |
| 52 | syn keyword dStructure template interface class struct union |
| 53 | syn keyword dEnum enum |
| 54 | syn keyword dOperator new delete typeof typeid cast align is |
| 55 | syn keyword dOperator this super |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 56 | if exists("d_hl_operator_overload") |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 57 | syn keyword dOpOverload opNeg opCom opPostInc opPostDec opCast opAdd |
| 58 | syn keyword dOpOverload opSub opSub_r opMul opDiv opDiv_r opMod |
| 59 | syn keyword dOpOverload opMod_r opAnd opOr opXor opShl opShl_r opShr |
| 60 | syn keyword dOpOverload opShr_r opUShr opUShr_r opCat |
| 61 | syn keyword dOpOverload opCat_r opEquals opEquals opCmp |
| 62 | syn keyword dOpOverload opAssign opAddAssign opSubAssign opMulAssign |
| 63 | syn keyword dOpOverload opDivAssign opModAssign opAndAssign |
| 64 | syn keyword dOpOverload opOrAssign opXorAssign opShlAssign |
| 65 | syn keyword dOpOverload opShrAssign opUShrAssign opCatAssign |
| 66 | syn keyword dOpOverload opIndex opIndexAssign opIndexOpAssign |
| 67 | syn keyword dOpOverload opCall opSlice opSliceAssign opSliceOpAssign |
| 68 | syn keyword dOpOverload opPos opAdd_r opMul_r opAnd_r opOr_r opXor_r |
| 69 | syn keyword dOpOverload opIn opIn_r opPow opDispatch opStar opDot |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 70 | syn keyword dOpOverload opApply opApplyReverse opDollar |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 71 | syn keyword dOpOverload opUnary opIndexUnary opSliceUnary |
| 72 | syn keyword dOpOverload opBinary opBinaryRight |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 73 | endif |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 74 | |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 75 | syn keyword dType byte ubyte short ushort int uint long ulong cent ucent |
| 76 | syn keyword dType void bool bit |
| 77 | syn keyword dType float double real |
| 78 | syn keyword dType ushort int uint long ulong float |
| 79 | syn keyword dType char wchar dchar string wstring dstring |
| 80 | syn keyword dType ireal ifloat idouble creal cfloat cdouble |
| 81 | syn keyword dType size_t ptrdiff_t sizediff_t equals_t hash_t |
| 82 | if exists("d_hl_object_types") |
| 83 | syn keyword dType Object Throwable AssociativeArray Error Exception |
| 84 | syn keyword dType Interface OffsetTypeInfo TypeInfo TypeInfo_Typedef |
| 85 | syn keyword dType TypeInfo_Enum TypeInfo_Pointer TypeInfo_Array |
| 86 | syn keyword dType TypeInfo_StaticArray TypeInfo_AssociativeArray |
| 87 | syn keyword dType TypeInfo_Function TypeInfo_Delegate TypeInfo_Class |
| 88 | syn keyword dType ClassInfo TypeInfo_Interface TypeInfo_Struct |
| 89 | syn keyword dType TypeInfo_Tuple TypeInfo_Const TypeInfo_Invariant |
| 90 | syn keyword dType TypeInfo_Shared TypeInfo_Inout MemberInfo |
| 91 | syn keyword dType MemberInfo_field MemberInfo_function ModuleInfo |
| 92 | endif |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 93 | syn keyword dDebug deprecated unittest invariant |
| 94 | syn keyword dExceptions throw try catch finally |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 95 | syn keyword dScopeDecl public protected private export package |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 96 | syn keyword dStatement debug return with |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 97 | syn keyword dStatement function delegate __ctfe mixin macro |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 98 | syn keyword dStorageClass in out inout ref lazy body |
| 99 | syn keyword dStorageClass pure nothrow |
| 100 | syn keyword dStorageClass auto static override final abstract volatile |
| 101 | syn keyword dStorageClass __gshared __thread |
| 102 | syn keyword dStorageClass synchronized shared immutable const lazy |
| 103 | syn keyword dPragma pragma |
| 104 | syn keyword dIdentifier _arguments _argptr __vptr __monitor _ctor _dtor |
| 105 | syn keyword dScopeIdentifier contained exit success failure |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 106 | syn keyword dTraitsIdentifier contained isAbstractClass isArithmetic isAssociativeArray |
| 107 | syn keyword dTraitsIdentifier contained isFinalClass isFloating isIntegral isScalar |
| 108 | syn keyword dTraitsIdentifier contained isStaticArray isUnsigned isVirtualFunction |
| 109 | syn keyword dTraitsIdentifier contained isAbstractFunction isFinalFunction isStaticFunction |
| 110 | syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember identifier getMember |
| 111 | syn keyword dTraitsIdentifier contained getOverloads getVirtualFunctions parent compiles |
| 112 | syn keyword dTraitsIdentifier contained classInstanceSize allMembers derivedMembers isSame |
| 113 | syn keyword dExternIdentifier contained Windows Pascal Java System D |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 114 | syn keyword dAttribute contained safe trusted system |
| 115 | syn keyword dAttribute contained property disable |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 116 | syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET |
| 117 | syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha |
| 118 | syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64 |
| 119 | syn keyword dVersionIdentifier contained linux Posix OSX FreeBSD Windows Win32 Win64 |
| 120 | syn keyword dVersionIdentifier contained OpenBSD BSD Solaris AIX SkyOS SysV3 SysV4 Hurd |
| 121 | syn keyword dVersionIdentifier contained Cygwin MinGW |
| 122 | syn keyword dVersionIdentifier contained LittleEndian BigEndian |
| 123 | syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64 |
| 124 | syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC |
| 125 | syn keyword dVersionIdentifier contained unittest none all |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 126 | |
| 127 | " Highlight the sharpbang |
| 128 | syn match dSharpBang "\%^#!.*" display |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 129 | |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 130 | " Attributes/annotations |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 131 | syn match dAnnotation "@[_$a-zA-Z][_$a-zA-Z0-9_]*\>" contains=dAttribute |
| 132 | |
| 133 | " Version Identifiers |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 134 | syn match dVersion "[^.]\<version\>"hs=s+1 nextgroup=dVersionInside |
| 135 | syn match dVersion "^\<version\>" nextgroup=dVersionInside |
| 136 | syn match dVersionInside "\s*([_a-zA-Z][_a-zA-Z0-9]*\>" transparent contained contains=dVersionIdentifier |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 137 | |
| 138 | " Scope StorageClass |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 139 | syn match dStorageClass "\<scope\>" |
| 140 | |
| 141 | " Traits Expression |
| 142 | syn match dStatement "\<__traits\>" |
| 143 | |
| 144 | " Extern Modifier |
| 145 | syn match dExternal "\<extern\>" |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 146 | |
| 147 | " Scope Identifiers |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 148 | syn match dScope "\<scope\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+5 contains=dScopeIdentifier |
| 149 | |
| 150 | " Traits Identifiers |
| 151 | syn match dTraits "\<__traits\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+8 contains=dTraitsIdentifier |
| 152 | |
| 153 | " Necessary to highlight C++ in extern modifiers. |
| 154 | syn match dExternIdentifier "C\(++\)\?" contained |
| 155 | |
| 156 | " Extern Identifiers |
| 157 | syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 158 | |
| 159 | " String is a statement and a module name. |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 160 | syn match dType "[^.]\<string\>"ms=s+1 |
| 161 | syn match dType "^\<string\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 162 | |
| 163 | " Assert is a statement and a module name. |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 164 | syn match dAssert "[^.]\<assert\>"ms=s+1 |
| 165 | syn match dAssert "^\<assert\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 166 | |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 167 | " dTokens is used by the token string highlighting |
| 168 | syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean |
| 169 | syn cluster dTokens add=dConstant,dTypedef,dStructure,dOperator,dOpOverload |
| 170 | syn cluster dTokens add=dType,dDebug,dExceptions,dScopeDecl,dStatement |
| 171 | syn cluster dTokens add=dStorageClass,dPragma,dAssert,dAnnotation |
| 172 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 173 | |
| 174 | " Labels |
| 175 | " |
| 176 | " We contain dScopeDecl so public: private: etc. are not highlighted like labels |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 177 | syn match dUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=dLabel,dScopeDecl,dEnum |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 178 | syn keyword dLabel case default |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 179 | |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 180 | syn cluster dTokens add=dUserLabel,dLabel |
| 181 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 182 | " Comments |
| 183 | " |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 184 | syn keyword dTodo contained TODO FIXME TEMP REFACTOR REVIEW HACK BUG XXX |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 185 | syn match dCommentStar contained "^\s*\*[^/]"me=e-1 |
| 186 | syn match dCommentStar contained "^\s*\*$" |
| 187 | syn match dCommentPlus contained "^\s*+[^/]"me=e-1 |
| 188 | syn match dCommentPlus contained "^\s*+$" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 189 | if exists("d_comment_strings") |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 190 | syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell |
| 191 | syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell |
| 192 | syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 193 | syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell fold |
| 194 | syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 195 | syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 196 | else |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 197 | syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell fold |
| 198 | syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 199 | syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 200 | endif |
| 201 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 202 | hi link dLineCommentString dBlockCommentString |
| 203 | hi link dBlockCommentString dString |
| 204 | hi link dNestedCommentString dString |
| 205 | hi link dCommentStar dBlockComment |
| 206 | hi link dCommentPlus dNestedComment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 207 | |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 208 | syn cluster dTokens add=dBlockComment,dNestedComment,dLineComment |
| 209 | |
Bram Moolenaar | 5baddf0 | 2006-03-12 21:53:56 +0000 | [diff] [blame] | 210 | " /+ +/ style comments and strings that span multiple lines can cause |
| 211 | " problems. To play it safe, set minlines to a large number. |
| 212 | syn sync minlines=200 |
| 213 | " Use ccomment for /* */ style comments |
| 214 | syn sync ccomment dBlockComment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 215 | |
| 216 | " Characters |
| 217 | " |
| 218 | syn match dSpecialCharError contained "[^']" |
| 219 | |
Bram Moolenaar | cd71fa3 | 2005-03-11 22:46:48 +0000 | [diff] [blame] | 220 | " Escape sequences (oct,specal char,hex,wchar, character entities \&xxx;) |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 221 | " These are not contained because they are considered string literals. |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 222 | syn match dEscSequence "\\\(\o\{1,3}\|[\"\\'\\?ntbrfva]\|u\x\{4}\|U\x\{8}\|x\x\x\)" |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 223 | syn match dEscSequence "\\&[^;& \t]\+;" |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 224 | syn match dCharacter "'[^']*'" contains=dEscSequence,dSpecialCharError |
| 225 | syn match dCharacter "'\\''" contains=dEscSequence |
| 226 | syn match dCharacter "'[^\\]'" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 227 | |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 228 | syn cluster dTokens add=dEscSequence,dCharacter |
| 229 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 230 | " Unicode characters |
| 231 | " |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 232 | syn match dUnicode "\\u\d\{4\}" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 233 | |
| 234 | " String. |
| 235 | " |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 236 | syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dEscSequence,@Spell |
| 237 | syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell |
| 238 | syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell |
| 239 | syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell |
| 240 | syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell |
| 241 | syn region dHereString start=+q"\z(\I\i*\)\n+ end=+\n\z1"+ contains=@Spell |
| 242 | |
| 243 | " Nesting delimited string contents |
| 244 | " |
| 245 | syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell |
| 246 | syn region dNestBrackString start=+\[+ end=+\]+ contained transparent contains=dNestBrackString,@Spell |
| 247 | syn region dNestAngleString start=+<+ end=+>+ contained transparent contains=dNestAngleString,@Spell |
| 248 | syn region dNestCurlyString start=+{+ end=+}+ contained transparent contains=dNestCurlyString,@Spell |
| 249 | |
| 250 | " Nesting delimited strings |
| 251 | " |
| 252 | syn region dParenString matchgroup=dParenString start=+q"(+ end=+)"+ contains=dNestParenString,@Spell |
| 253 | syn region dBrackString matchgroup=dBrackString start=+q"\[+ end=+\]"+ contains=dNestBrackString,@Spell |
| 254 | syn region dAngleString matchgroup=dAngleString start=+q"<+ end=+>"+ contains=dNestAngleString,@Spell |
| 255 | syn region dCurlyString matchgroup=dCurlyString start=+q"{+ end=+}"+ contains=dNestCurlyString,@Spell |
| 256 | |
| 257 | hi link dParenString dNestString |
| 258 | hi link dBrackString dNestString |
| 259 | hi link dAngleString dNestString |
| 260 | hi link dCurlyString dNestString |
| 261 | |
| 262 | syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString |
| 263 | |
| 264 | " Token strings |
| 265 | " |
| 266 | syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens |
| 267 | syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens |
| 268 | |
| 269 | syn cluster dTokens add=dTokenString |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 270 | |
| 271 | " Numbers |
| 272 | " |
| 273 | syn case ignore |
Bram Moolenaar | 5baddf0 | 2006-03-12 21:53:56 +0000 | [diff] [blame] | 274 | |
| 275 | syn match dDec display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>" |
| 276 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 277 | " Hex number |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 278 | syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>" |
Bram Moolenaar | 5baddf0 | 2006-03-12 21:53:56 +0000 | [diff] [blame] | 279 | |
| 280 | syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>" |
| 281 | " flag an octal number with wrong digits |
| 282 | syn match dOctalError display "\<0[0-7_]*[89][0-9_]*" |
| 283 | |
| 284 | " binary numbers |
| 285 | syn match dBinary display "\<0b[01_]\+\(u\=l\=\|l\=u\=\)\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 286 | |
| 287 | "floating point without the dot |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 288 | syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 289 | "floating point number, with dot, optional exponent |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 290 | syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 291 | "floating point number, starting with a dot, optional exponent |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 292 | syn match dFloat display "\(\.[0-9_]\+\)\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 293 | "floating point number, without dot, with exponent |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 294 | "syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>" |
| 295 | syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 296 | |
| 297 | "floating point without the dot |
Bram Moolenaar | 5baddf0 | 2006-03-12 21:53:56 +0000 | [diff] [blame] | 298 | syn match dHexFloat display "\<0x[0-9a-f_]\+\(fi\=\|l\=i\)\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 299 | "floating point number, with dot, optional exponent |
Bram Moolenaar | 5baddf0 | 2006-03-12 21:53:56 +0000 | [diff] [blame] | 300 | syn match dHexFloat display "\<0x[0-9a-f_]\+\.[0-9a-f_]*\(p[-+]\=[0-9_]\+\)\=[fl]\=i\=" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 301 | "floating point number, without dot, with exponent |
Bram Moolenaar | 5baddf0 | 2006-03-12 21:53:56 +0000 | [diff] [blame] | 302 | syn match dHexFloat display "\<0x[0-9a-f_]\+p[-+]\=[0-9_]\+[fl]\=i\=\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 303 | |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 304 | syn cluster dTokens add=dDec,dHex,dOctal,dOctalError,dBinary,dFloat,dHexFloat |
| 305 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 306 | syn case match |
| 307 | |
| 308 | " Pragma (preprocessor) support |
| 309 | " TODO: Highlight following Integer and optional Filespec. |
| 310 | syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$" |
| 311 | |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 312 | " Block |
| 313 | " |
| 314 | syn region dBlock start="{" end="}" transparent fold |
| 315 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 316 | |
| 317 | " The default highlighting. |
| 318 | " |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 319 | hi def link dBinary Number |
| 320 | hi def link dDec Number |
| 321 | hi def link dHex Number |
| 322 | hi def link dOctal Number |
| 323 | hi def link dFloat Float |
| 324 | hi def link dHexFloat Float |
| 325 | hi def link dDebug Debug |
| 326 | hi def link dBranch Conditional |
| 327 | hi def link dConditional Conditional |
| 328 | hi def link dLabel Label |
| 329 | hi def link dUserLabel Label |
| 330 | hi def link dRepeat Repeat |
| 331 | hi def link dExceptions Exception |
| 332 | hi def link dAssert Statement |
| 333 | hi def link dStatement Statement |
| 334 | hi def link dScopeDecl dStorageClass |
| 335 | hi def link dStorageClass StorageClass |
| 336 | hi def link dBoolean Boolean |
| 337 | hi def link dUnicode Special |
| 338 | hi def link dTokenStringBrack String |
| 339 | hi def link dHereString String |
| 340 | hi def link dNestString String |
| 341 | hi def link dDelimString String |
| 342 | hi def link dRawString String |
| 343 | hi def link dString String |
| 344 | hi def link dHexString String |
| 345 | hi def link dCharacter Character |
| 346 | hi def link dEscSequence SpecialChar |
| 347 | hi def link dSpecialCharError Error |
| 348 | hi def link dOctalError Error |
| 349 | hi def link dOperator Operator |
| 350 | hi def link dOpOverload Identifier |
| 351 | hi def link dConstant Constant |
| 352 | hi def link dTypedef Typedef |
| 353 | hi def link dEnum Structure |
| 354 | hi def link dStructure Structure |
| 355 | hi def link dTodo Todo |
| 356 | hi def link dType Type |
| 357 | hi def link dLineComment Comment |
| 358 | hi def link dBlockComment Comment |
| 359 | hi def link dNestedComment Comment |
| 360 | hi def link dExternal Include |
| 361 | hi def link dPragma PreProc |
| 362 | hi def link dAnnotation PreProc |
| 363 | hi def link dSharpBang PreProc |
| 364 | hi def link dAttribute StorageClass |
| 365 | hi def link dIdentifier Identifier |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 366 | hi def link dVersion dStatement |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 367 | hi def link dVersionIdentifier Identifier |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 368 | hi def link dScope dStorageClass |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 369 | hi def link dScopeIdentifier Identifier |
| 370 | hi def link dTraits dStatement |
| 371 | hi def link dTraitsIdentifier Identifier |
| 372 | hi def link dExtern dExternal |
| 373 | hi def link dExternIdentifier Identifier |
Bram Moolenaar | 9db9d9c | 2010-01-16 14:29:14 +0100 | [diff] [blame] | 374 | |
Bram Moolenaar | 24ea3ba | 2010-09-19 19:01:21 +0200 | [diff] [blame] | 375 | " Marks contents of the asm statment body as special |
| 376 | |
| 377 | syn match dAsmStatement "\<asm\>" |
| 378 | syn region dAsmBody start="asm[\n]*\s*{"hs=e+1 end="}"he=e-1 contains=dAsmStatement,dAsmOpCode |
| 379 | |
| 380 | hi def link dAsmBody dUnicode |
| 381 | hi def link dAsmStatement dStatement |
| 382 | hi def link dAsmOpCode Identifier |
| 383 | |
| 384 | syn keyword dAsmOpCode contained aaa aad aam aas adc |
| 385 | syn keyword dAsmOpCode contained add addpd addps addsd addss |
| 386 | syn keyword dAsmOpCode contained and andnpd andnps andpd andps |
| 387 | syn keyword dAsmOpCode contained arpl bound bsf bsr bswap |
| 388 | syn keyword dAsmOpCode contained bt btc btr bts call |
| 389 | syn keyword dAsmOpCode contained cbw cdq clc cld clflush |
| 390 | syn keyword dAsmOpCode contained cli clts cmc cmova cmovae |
| 391 | syn keyword dAsmOpCode contained cmovb cmovbe cmovc cmove cmovg |
| 392 | syn keyword dAsmOpCode contained cmovge cmovl cmovle cmovna cmovnae |
| 393 | syn keyword dAsmOpCode contained cmovnb cmovnbe cmovnc cmovne cmovng |
| 394 | syn keyword dAsmOpCode contained cmovnge cmovnl cmovnle cmovno cmovnp |
| 395 | syn keyword dAsmOpCode contained cmovns cmovnz cmovo cmovp cmovpe |
| 396 | syn keyword dAsmOpCode contained cmovpo cmovs cmovz cmp cmppd |
| 397 | syn keyword dAsmOpCode contained cmpps cmps cmpsb cmpsd cmpss |
| 398 | syn keyword dAsmOpCode contained cmpsw cmpxch8b cmpxchg comisd comiss |
| 399 | syn keyword dAsmOpCode contained cpuid cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi |
| 400 | syn keyword dAsmOpCode contained cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd |
| 401 | syn keyword dAsmOpCode contained cvtps2pi cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss |
| 402 | syn keyword dAsmOpCode contained cvtss2sd cvtss2si cvttpd2dq cvttpd2pi cvttps2dq |
| 403 | syn keyword dAsmOpCode contained cvttps2pi cvttsd2si cvttss2si cwd cwde |
| 404 | syn keyword dAsmOpCode contained da daa das db dd |
| 405 | syn keyword dAsmOpCode contained de dec df di div |
| 406 | syn keyword dAsmOpCode contained divpd divps divsd divss dl |
| 407 | syn keyword dAsmOpCode contained dq ds dt dw emms |
| 408 | syn keyword dAsmOpCode contained enter f2xm1 fabs fadd faddp |
| 409 | syn keyword dAsmOpCode contained fbld fbstp fchs fclex fcmovb |
| 410 | syn keyword dAsmOpCode contained fcmovbe fcmove fcmovnb fcmovnbe fcmovne |
| 411 | syn keyword dAsmOpCode contained fcmovnu fcmovu fcom fcomi fcomip |
| 412 | syn keyword dAsmOpCode contained fcomp fcompp fcos fdecstp fdisi |
| 413 | syn keyword dAsmOpCode contained fdiv fdivp fdivr fdivrp feni |
| 414 | syn keyword dAsmOpCode contained ffree fiadd ficom ficomp fidiv |
| 415 | syn keyword dAsmOpCode contained fidivr fild fimul fincstp finit |
| 416 | syn keyword dAsmOpCode contained fist fistp fisub fisubr fld |
| 417 | syn keyword dAsmOpCode contained fld1 fldcw fldenv fldl2e fldl2t |
| 418 | syn keyword dAsmOpCode contained fldlg2 fldln2 fldpi fldz fmul |
| 419 | syn keyword dAsmOpCode contained fmulp fnclex fndisi fneni fninit |
| 420 | syn keyword dAsmOpCode contained fnop fnsave fnstcw fnstenv fnstsw |
| 421 | syn keyword dAsmOpCode contained fpatan fprem fprem1 fptan frndint |
| 422 | syn keyword dAsmOpCode contained frstor fsave fscale fsetpm fsin |
| 423 | syn keyword dAsmOpCode contained fsincos fsqrt fst fstcw fstenv |
| 424 | syn keyword dAsmOpCode contained fstp fstsw fsub fsubp fsubr |
| 425 | syn keyword dAsmOpCode contained fsubrp ftst fucom fucomi fucomip |
| 426 | syn keyword dAsmOpCode contained fucomp fucompp fwait fxam fxch |
| 427 | syn keyword dAsmOpCode contained fxrstor fxsave fxtract fyl2x fyl2xp1 |
| 428 | syn keyword dAsmOpCode contained hlt idiv imul in inc |
| 429 | syn keyword dAsmOpCode contained ins insb insd insw int |
| 430 | syn keyword dAsmOpCode contained into invd invlpg iret iretd |
| 431 | syn keyword dAsmOpCode contained ja jae jb jbe jc |
| 432 | syn keyword dAsmOpCode contained jcxz je jecxz jg jge |
| 433 | syn keyword dAsmOpCode contained jl jle jmp jna jnae |
| 434 | syn keyword dAsmOpCode contained jnb jnbe jnc jne jng |
| 435 | syn keyword dAsmOpCode contained jnge jnl jnle jno jnp |
| 436 | syn keyword dAsmOpCode contained jns jnz jo jp jpe |
| 437 | syn keyword dAsmOpCode contained jpo js jz lahf lar |
| 438 | syn keyword dAsmOpCode contained ldmxcsr lds lea leave les |
| 439 | syn keyword dAsmOpCode contained lfence lfs lgdt lgs lidt |
| 440 | syn keyword dAsmOpCode contained lldt lmsw lock lods lodsb |
| 441 | syn keyword dAsmOpCode contained lodsd lodsw loop loope loopne |
| 442 | syn keyword dAsmOpCode contained loopnz loopz lsl lss ltr |
| 443 | syn keyword dAsmOpCode contained maskmovdqu maskmovq maxpd maxps maxsd |
| 444 | syn keyword dAsmOpCode contained maxss mfence minpd minps minsd |
| 445 | syn keyword dAsmOpCode contained minss mov movapd movaps movd |
| 446 | syn keyword dAsmOpCode contained movdq2q movdqa movdqu movhlps movhpd |
| 447 | syn keyword dAsmOpCode contained movhps movlhps movlpd movlps movmskpd |
| 448 | syn keyword dAsmOpCode contained movmskps movntdq movnti movntpd movntps |
| 449 | syn keyword dAsmOpCode contained movntq movq movq2dq movs movsb |
| 450 | syn keyword dAsmOpCode contained movsd movss movsw movsx movupd |
| 451 | syn keyword dAsmOpCode contained movups movzx mul mulpd mulps |
| 452 | syn keyword dAsmOpCode contained mulsd mulss neg nop not |
| 453 | syn keyword dAsmOpCode contained or orpd orps out outs |
| 454 | syn keyword dAsmOpCode contained outsb outsd outsw packssdw packsswb |
| 455 | syn keyword dAsmOpCode contained packuswb paddb paddd paddq paddsb |
| 456 | syn keyword dAsmOpCode contained paddsw paddusb paddusw paddw pand |
| 457 | syn keyword dAsmOpCode contained pandn pavgb pavgw pcmpeqb pcmpeqd |
| 458 | syn keyword dAsmOpCode contained pcmpeqw pcmpgtb pcmpgtd pcmpgtw pextrw |
| 459 | syn keyword dAsmOpCode contained pinsrw pmaddwd pmaxsw pmaxub pminsw |
| 460 | syn keyword dAsmOpCode contained pminub pmovmskb pmulhuw pmulhw pmullw |
| 461 | syn keyword dAsmOpCode contained pmuludq pop popa popad popf |
| 462 | syn keyword dAsmOpCode contained popfd por prefetchnta prefetcht0 prefetcht1 |
| 463 | syn keyword dAsmOpCode contained prefetcht2 psadbw pshufd pshufhw pshuflw |
| 464 | syn keyword dAsmOpCode contained pshufw pslld pslldq psllq psllw |
| 465 | syn keyword dAsmOpCode contained psrad psraw psrld psrldq psrlq |
| 466 | syn keyword dAsmOpCode contained psrlw psubb psubd psubq psubsb |
| 467 | syn keyword dAsmOpCode contained psubsw psubusb psubusw psubw punpckhbw |
| 468 | syn keyword dAsmOpCode contained punpckhdq punpckhqdq punpckhwd punpcklbw punpckldq |
| 469 | syn keyword dAsmOpCode contained punpcklqdq punpcklwd push pusha pushad |
| 470 | syn keyword dAsmOpCode contained pushf pushfd pxor rcl rcpps |
| 471 | syn keyword dAsmOpCode contained rcpss rcr rdmsr rdpmc rdtsc |
| 472 | syn keyword dAsmOpCode contained rep repe repne repnz repz |
| 473 | syn keyword dAsmOpCode contained ret retf rol ror rsm |
| 474 | syn keyword dAsmOpCode contained rsqrtps rsqrtss sahf sal sar |
| 475 | syn keyword dAsmOpCode contained sbb scas scasb scasd scasw |
| 476 | syn keyword dAsmOpCode contained seta setae setb setbe setc |
| 477 | syn keyword dAsmOpCode contained sete setg setge setl setle |
| 478 | syn keyword dAsmOpCode contained setna setnae setnb setnbe setnc |
| 479 | syn keyword dAsmOpCode contained setne setng setnge setnl setnle |
| 480 | syn keyword dAsmOpCode contained setno setnp setns setnz seto |
| 481 | syn keyword dAsmOpCode contained setp setpe setpo sets setz |
| 482 | syn keyword dAsmOpCode contained sfence sgdt shl shld shr |
| 483 | syn keyword dAsmOpCode contained shrd shufpd shufps sidt sldt |
| 484 | syn keyword dAsmOpCode contained smsw sqrtpd sqrtps sqrtsd sqrtss |
| 485 | syn keyword dAsmOpCode contained stc std sti stmxcsr stos |
| 486 | syn keyword dAsmOpCode contained stosb stosd stosw str sub |
| 487 | syn keyword dAsmOpCode contained subpd subps subsd subss sysenter |
| 488 | syn keyword dAsmOpCode contained sysexit test ucomisd ucomiss ud2 |
| 489 | syn keyword dAsmOpCode contained unpckhpd unpckhps unpcklpd unpcklps verr |
| 490 | syn keyword dAsmOpCode contained verw wait wbinvd wrmsr xadd |
| 491 | syn keyword dAsmOpCode contained xchg xlat xlatb xor xorpd |
| 492 | syn keyword dAsmOpCode contained xorps |
| 493 | syn keyword dAsmOpCode contained addsubpd addsubps fisttp haddpd haddps |
| 494 | syn keyword dAsmOpCode contained hsubpd hsubps lddqu monitor movddup |
| 495 | syn keyword dAsmOpCode contained movshdup movsldup mwait |
| 496 | syn keyword dAsmOpCode contained pavgusb pf2id pfacc pfadd pfcmpeq |
| 497 | syn keyword dAsmOpCode contained pfcmpge pfcmpgt pfmax pfmin pfmul |
| 498 | syn keyword dAsmOpCode contained pfnacc pfpnacc pfrcp pfrcpit1 pfrcpit2 |
| 499 | syn keyword dAsmOpCode contained pfrsqit1 pfrsqrt pfsub pfsubr pi2fd |
| 500 | syn keyword dAsmOpCode contained pmulhrw pswapd |
| 501 | |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 502 | let &cpo = s:cpo_save |
| 503 | unlet s:cpo_save |