blob: fdac98c437121a7b276aefc66956d32b6af3f56e [file] [log] [blame]
Bram Moolenaar681baaf2016-02-04 20:57:07 +01001" Vim syntax file for the D programming language (version 1.076 and 2.069).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002"
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +02003" Language: D
4" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
Bram Moolenaar681baaf2016-02-04 20:57:07 +01005" Last Change: 2016 Feb 2
6" Version: 0.28
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +01007"
8" Contributors:
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02009" - Jason Mills: original Maintainer
Bram Moolenaar6be7f872012-01-20 21:08:56 +010010" - Kirk McDonald
11" - Tim Keating
12" - Frank Benoit
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020013" - Shougo Matsushita
Bram Moolenaar6be7f872012-01-20 21:08:56 +010014" - Ellery Newcomer
15" - Steven N. Oliver
16" - Sohgo Takeuchi
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020017" - Robert Clipsham
Bram Moolenaar681baaf2016-02-04 20:57:07 +010018" - Petar Kirov
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +010019"
Bram Moolenaar6be7f872012-01-20 21:08:56 +010020" Please submit bugs/comments/suggestions to the github repo:
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020021" https://github.com/JesseKPhillips/d.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000022"
23" Options:
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +010024" d_comment_strings - Set to highlight strings and numbers in comments.
Bram Moolenaar071d4272004-06-13 20:20:40 +000025"
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +010026" d_hl_operator_overload - Set to highlight D's specially named functions
27" that when overloaded implement unary and binary operators (e.g. opCmp).
Bram Moolenaar071d4272004-06-13 20:20:40 +000028"
Bram Moolenaar6be7f872012-01-20 21:08:56 +010029" d_hl_object_types - Set to highlight some common types from object.di.
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
31" Quit when a syntax file was already loaded
32if exists("b:current_syntax")
33 finish
34endif
35
Bram Moolenaar6be7f872012-01-20 21:08:56 +010036" Support cpoptions
37let s:cpo_save = &cpo
38set cpo&vim
39
40" Set the current syntax to be known as d
41let b:current_syntax = "d"
42
Bram Moolenaar071d4272004-06-13 20:20:40 +000043" Keyword definitions
44"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020045syn keyword dExternal contained import module
46syn keyword dAssert assert
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020047syn keyword dConditional if else switch
48syn keyword dBranch goto break continue
49syn keyword dRepeat while for do foreach foreach_reverse
50syn keyword dBoolean true false
51syn keyword dConstant null
52syn keyword dConstant __FILE__ __LINE__ __EOF__ __VERSION__
53syn keyword dConstant __DATE__ __TIME__ __TIMESTAMP__ __VENDOR__
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020054syn keyword dConstant __MODULE__ __FUNCTION__ __PRETTY_FUNCTION__
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020055syn keyword dTypedef alias typedef
56syn keyword dStructure template interface class struct union
57syn keyword dEnum enum
58syn keyword dOperator new delete typeof typeid cast align is
59syn keyword dOperator this super
Bram Moolenaar071d4272004-06-13 20:20:40 +000060if exists("d_hl_operator_overload")
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020061 syn keyword dOpOverload opNeg opCom opPostInc opPostDec opCast opAdd
62 syn keyword dOpOverload opSub opSub_r opMul opDiv opDiv_r opMod
63 syn keyword dOpOverload opMod_r opAnd opOr opXor opShl opShl_r opShr
64 syn keyword dOpOverload opShr_r opUShr opUShr_r opCat
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020065 syn keyword dOpOverload opCat_r opEquals opCmp
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020066 syn keyword dOpOverload opAssign opAddAssign opSubAssign opMulAssign
67 syn keyword dOpOverload opDivAssign opModAssign opAndAssign
68 syn keyword dOpOverload opOrAssign opXorAssign opShlAssign
69 syn keyword dOpOverload opShrAssign opUShrAssign opCatAssign
70 syn keyword dOpOverload opIndex opIndexAssign opIndexOpAssign
71 syn keyword dOpOverload opCall opSlice opSliceAssign opSliceOpAssign
72 syn keyword dOpOverload opPos opAdd_r opMul_r opAnd_r opOr_r opXor_r
73 syn keyword dOpOverload opIn opIn_r opPow opDispatch opStar opDot
Bram Moolenaar6be7f872012-01-20 21:08:56 +010074 syn keyword dOpOverload opApply opApplyReverse opDollar
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020075 syn keyword dOpOverload opUnary opIndexUnary opSliceUnary
76 syn keyword dOpOverload opBinary opBinaryRight
Bram Moolenaar071d4272004-06-13 20:20:40 +000077endif
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020078
Bram Moolenaar6be7f872012-01-20 21:08:56 +010079syn keyword dType byte ubyte short ushort int uint long ulong cent ucent
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020080syn keyword dType void bool Object
Bram Moolenaar6be7f872012-01-20 21:08:56 +010081syn keyword dType float double real
82syn keyword dType ushort int uint long ulong float
83syn keyword dType char wchar dchar string wstring dstring
84syn keyword dType ireal ifloat idouble creal cfloat cdouble
85syn keyword dType size_t ptrdiff_t sizediff_t equals_t hash_t
86if exists("d_hl_object_types")
87 syn keyword dType Object Throwable AssociativeArray Error Exception
88 syn keyword dType Interface OffsetTypeInfo TypeInfo TypeInfo_Typedef
89 syn keyword dType TypeInfo_Enum TypeInfo_Pointer TypeInfo_Array
90 syn keyword dType TypeInfo_StaticArray TypeInfo_AssociativeArray
91 syn keyword dType TypeInfo_Function TypeInfo_Delegate TypeInfo_Class
92 syn keyword dType ClassInfo TypeInfo_Interface TypeInfo_Struct
93 syn keyword dType TypeInfo_Tuple TypeInfo_Const TypeInfo_Invariant
94 syn keyword dType TypeInfo_Shared TypeInfo_Inout MemberInfo
95 syn keyword dType MemberInfo_field MemberInfo_function ModuleInfo
96endif
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020097syn keyword dDebug deprecated unittest invariant
98syn keyword dExceptions throw try catch finally
Bram Moolenaar6be7f872012-01-20 21:08:56 +010099syn keyword dScopeDecl public protected private export package
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200100syn keyword dStatement debug return with
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200101syn keyword dStatement function delegate __ctfe mixin macro __simd
102syn keyword dStatement in out body
103syn keyword dStorageClass contained in out scope
104syn keyword dStorageClass inout ref lazy pure nothrow
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200105syn keyword dStorageClass auto static override final abstract volatile
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200106syn keyword dStorageClass __gshared __vector
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200107syn keyword dStorageClass synchronized shared immutable const lazy
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200108syn keyword dIdentifier _arguments _argptr __vptr __monitor
109syn keyword dIdentifier _ctor _dtor __argTypes __overloadset
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200110syn keyword dScopeIdentifier contained exit success failure
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200111syn keyword dTraitsIdentifier contained isAbstractClass isArithmetic
112syn keyword dTraitsIdentifier contained isAssociativeArray isFinalClass
113syn keyword dTraitsIdentifier contained isPOD isNested isFloating
114syn keyword dTraitsIdentifier contained isIntegral isScalar isStaticArray
115syn keyword dTraitsIdentifier contained isUnsigned isVirtualFunction
116syn keyword dTraitsIdentifier contained isVirtualMethod isAbstractFunction
117syn keyword dTraitsIdentifier contained isFinalFunction isStaticFunction
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100118syn keyword dTraitsIdentifier contained isOverrideFunction isTemplate
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200119syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100120syn keyword dTraitsIdentifier contained identifier getAliasThis
121syn keyword dTraitsIdentifier contained getAttributes getFunctionAttributes getMember
122syn keyword dTraitsIdentifier contained getOverloads getPointerBitmap getProtection
123syn keyword dTraitsIdentifier contained getVirtualFunctions getVirtualIndex
124syn keyword dTraitsIdentifier contained getVirtualMethods getUnitTests
125syn keyword dTraitsIdentifier contained parent classInstanceSize allMembers
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200126syn keyword dTraitsIdentifier contained derivedMembers isSame compiles
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100127syn keyword dPragmaIdentifier contained inline lib mangle msg startaddress GNU_asm
128syn keyword dExternIdentifier contained C C++ D Windows Pascal System Objective-C
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200129syn keyword dAttribute contained safe trusted system
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100130syn keyword dAttribute contained property disable nogc
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100131syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET
132syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha
133syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64
134syn keyword dVersionIdentifier contained linux Posix OSX FreeBSD Windows Win32 Win64
135syn keyword dVersionIdentifier contained OpenBSD BSD Solaris AIX SkyOS SysV3 SysV4 Hurd
136syn keyword dVersionIdentifier contained Cygwin MinGW
137syn keyword dVersionIdentifier contained LittleEndian BigEndian
138syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64
139syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100140syn keyword dVersionIdentifier contained unittest assert none all
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200141
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200142syn cluster dComment contains=dNestedComment,dBlockComment,dLineComment
143
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200144" Highlight the sharpbang
145syn match dSharpBang "\%^#!.*" display
Bram Moolenaar071d4272004-06-13 20:20:40 +0000146
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100147" Attributes/annotations
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200148syn match dAnnotation "@[_$a-zA-Z][_$a-zA-Z0-9_]*\>" contains=dAttribute
149
150" Version Identifiers
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200151syn match dVersion "\<version\>"
152syn match dVersion "\<version\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+7 contains=dVersionIdentifier
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200153
154" Scope Identifiers
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200155syn match dStatement "\<scope\>"
156syn match dStatement "\<scope\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+5 contains=dScopeIdentifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100157
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200158" Traits Statement
159syn match dStatement "\<__traits\>"
160syn match dStatement "\<__traits\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+8 contains=dTraitsIdentifier
161
162" Pragma Statement
163syn match dPragma "\<pragma\>"
Bram Moolenaarb1332082013-10-06 14:22:40 +0200164syn match dPragma "\<pragma\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+6 contains=dPragmaIdentifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100165
166" Necessary to highlight C++ in extern modifiers.
167syn match dExternIdentifier "C\(++\)\?" contained
168
169" Extern Identifiers
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200170syn match dExternal "\<extern\>"
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100171syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200172
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200173" Make import a region to prevent highlighting keywords
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100174syn region dImport start="\<import\_s" end=";" contains=dExternal,@dComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200176" Make module a region to prevent highlighting keywords
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100177syn region dImport start="\<module\_s" end=";" contains=dExternal,@dComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000178
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100179" dTokens is used by the token string highlighting
180syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean
181syn cluster dTokens add=dConstant,dTypedef,dStructure,dOperator,dOpOverload
182syn cluster dTokens add=dType,dDebug,dExceptions,dScopeDecl,dStatement
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200183syn cluster dTokens add=dStorageClass,dPragma,dAssert,dAnnotation,dEnum
Bram Moolenaarb1332082013-10-06 14:22:40 +0200184syn cluster dTokens add=dParenString,dBrackString,dAngleString,dCurlyString
185syn cluster dTokens add=dTokenString,dDelimString,dHereString
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100186
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200187" Create a match for parameter lists to identify storage class
188syn region paramlist start="(" end=")" contains=@dTokens
Bram Moolenaar071d4272004-06-13 20:20:40 +0000189
190" Labels
191"
192" We contain dScopeDecl so public: private: etc. are not highlighted like labels
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100193syn match dUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=dLabel,dScopeDecl,dEnum
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200194syn keyword dLabel case default
Bram Moolenaar071d4272004-06-13 20:20:40 +0000195
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100196syn cluster dTokens add=dUserLabel,dLabel
197
Bram Moolenaar071d4272004-06-13 20:20:40 +0000198" Comments
199"
Bram Moolenaarb1332082013-10-06 14:22:40 +0200200syn match dCommentError display "\*/"
201syn match dNestedCommentError display "+/"
202
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200203syn keyword dTodo contained TODO FIXME TEMP REFACTOR REVIEW HACK BUG XXX
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000204syn match dCommentStar contained "^\s*\*[^/]"me=e-1
205syn match dCommentStar contained "^\s*\*$"
206syn match dCommentPlus contained "^\s*+[^/]"me=e-1
207syn match dCommentPlus contained "^\s*+$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000208if exists("d_comment_strings")
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000209 syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell
210 syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell
211 syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000212endif
213
Bram Moolenaarb1332082013-10-06 14:22:40 +0200214syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,dCommentStartError,@Spell fold
215syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold
216syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
217
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000218hi link dLineCommentString dBlockCommentString
219hi link dBlockCommentString dString
220hi link dNestedCommentString dString
221hi link dCommentStar dBlockComment
222hi link dCommentPlus dNestedComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000223
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100224syn cluster dTokens add=dBlockComment,dNestedComment,dLineComment
225
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000226" /+ +/ style comments and strings that span multiple lines can cause
227" problems. To play it safe, set minlines to a large number.
228syn sync minlines=200
229" Use ccomment for /* */ style comments
230syn sync ccomment dBlockComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231
232" Characters
233"
234syn match dSpecialCharError contained "[^']"
235
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000236" Escape sequences (oct,specal char,hex,wchar, character entities \&xxx;)
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100237" These are not contained because they are considered string literals.
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000238syn match dEscSequence "\\\(\o\{1,3}\|[\"\\'\\?ntbrfva]\|u\x\{4}\|U\x\{8}\|x\x\x\)"
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100239syn match dEscSequence "\\&[^;& \t]\+;"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000240syn match dCharacter "'[^']*'" contains=dEscSequence,dSpecialCharError
241syn match dCharacter "'\\''" contains=dEscSequence
242syn match dCharacter "'[^\\]'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000243
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100244syn cluster dTokens add=dEscSequence,dCharacter
245
Bram Moolenaar071d4272004-06-13 20:20:40 +0000246" Unicode characters
247"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000248syn match dUnicode "\\u\d\{4\}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000249
250" String.
251"
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100252syn match dFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
253syn match dFormat display "%%" contained
254
255syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dFormat,dEscSequence,@Spell
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100256syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell
257syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell
258syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell
259syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell
Bram Moolenaarb1332082013-10-06 14:22:40 +0200260syn region dHereString start=+q"\z(\I\i*\)\n+ end=+^\z1"+ contains=@Spell
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100261
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100262
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100263" Nesting delimited string contents
264"
265syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell
266syn region dNestBrackString start=+\[+ end=+\]+ contained transparent contains=dNestBrackString,@Spell
267syn region dNestAngleString start=+<+ end=+>+ contained transparent contains=dNestAngleString,@Spell
268syn region dNestCurlyString start=+{+ end=+}+ contained transparent contains=dNestCurlyString,@Spell
269
270" Nesting delimited strings
271"
272syn region dParenString matchgroup=dParenString start=+q"(+ end=+)"+ contains=dNestParenString,@Spell
273syn region dBrackString matchgroup=dBrackString start=+q"\[+ end=+\]"+ contains=dNestBrackString,@Spell
274syn region dAngleString matchgroup=dAngleString start=+q"<+ end=+>"+ contains=dNestAngleString,@Spell
275syn region dCurlyString matchgroup=dCurlyString start=+q"{+ end=+}"+ contains=dNestCurlyString,@Spell
276
277hi link dParenString dNestString
278hi link dBrackString dNestString
279hi link dAngleString dNestString
280hi link dCurlyString dNestString
281
282syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString
283
284" Token strings
285"
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100286syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens,dFormat
287syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens,dFormat
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100288
289syn cluster dTokens add=dTokenString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000290
291" Numbers
292"
293syn case ignore
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000294
295syn match dDec display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>"
296
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297" Hex number
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000298syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>"
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000299
300syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>"
301" flag an octal number with wrong digits
302syn match dOctalError display "\<0[0-7_]*[89][0-9_]*"
303
304" binary numbers
305syn match dBinary display "\<0b[01_]\+\(u\=l\=\|l\=u\=\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000306
307"floating point without the dot
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000308syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000309"floating point number, with dot, optional exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000310syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\="
Bram Moolenaar071d4272004-06-13 20:20:40 +0000311"floating point number, starting with a dot, optional exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000312syn match dFloat display "\(\.[0-9_]\+\)\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000313"floating point number, without dot, with exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000314"syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>"
315syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000316
317"floating point without the dot
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000318syn match dHexFloat display "\<0x[0-9a-f_]\+\(fi\=\|l\=i\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000319"floating point number, with dot, optional exponent
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000320syn match dHexFloat display "\<0x[0-9a-f_]\+\.[0-9a-f_]*\(p[-+]\=[0-9_]\+\)\=[fl]\=i\="
Bram Moolenaar071d4272004-06-13 20:20:40 +0000321"floating point number, without dot, with exponent
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000322syn match dHexFloat display "\<0x[0-9a-f_]\+p[-+]\=[0-9_]\+[fl]\=i\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000323
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100324syn cluster dTokens add=dDec,dHex,dOctal,dOctalError,dBinary,dFloat,dHexFloat
325
Bram Moolenaar071d4272004-06-13 20:20:40 +0000326syn case match
327
328" Pragma (preprocessor) support
329" TODO: Highlight following Integer and optional Filespec.
330syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$"
331
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100332" Block
333"
334syn region dBlock start="{" end="}" transparent fold
335
Bram Moolenaar071d4272004-06-13 20:20:40 +0000336
337" The default highlighting.
338"
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200339hi def link dBinary Number
340hi def link dDec Number
341hi def link dHex Number
342hi def link dOctal Number
343hi def link dFloat Float
344hi def link dHexFloat Float
345hi def link dDebug Debug
346hi def link dBranch Conditional
347hi def link dConditional Conditional
348hi def link dLabel Label
349hi def link dUserLabel Label
350hi def link dRepeat Repeat
351hi def link dExceptions Exception
352hi def link dAssert Statement
353hi def link dStatement Statement
354hi def link dScopeDecl dStorageClass
355hi def link dStorageClass StorageClass
356hi def link dBoolean Boolean
357hi def link dUnicode Special
358hi def link dTokenStringBrack String
359hi def link dHereString String
360hi def link dNestString String
361hi def link dDelimString String
362hi def link dRawString String
363hi def link dString String
364hi def link dHexString String
365hi def link dCharacter Character
366hi def link dEscSequence SpecialChar
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100367hi def link dFormat SpecialChar
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200368hi def link dSpecialCharError Error
369hi def link dOctalError Error
370hi def link dOperator Operator
371hi def link dOpOverload Identifier
372hi def link dConstant Constant
373hi def link dTypedef Typedef
374hi def link dEnum Structure
375hi def link dStructure Structure
376hi def link dTodo Todo
377hi def link dType Type
378hi def link dLineComment Comment
379hi def link dBlockComment Comment
380hi def link dNestedComment Comment
Bram Moolenaarb1332082013-10-06 14:22:40 +0200381hi def link dCommentError Error
382hi def link dNestedCommentError Error
383hi def link dCommentStartError Error
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200384hi def link dExternal Include
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200385hi def link dAnnotation PreProc
386hi def link dSharpBang PreProc
387hi def link dAttribute StorageClass
388hi def link dIdentifier Identifier
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200389hi def link dVersion dStatement
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100390hi def link dVersionIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100391hi def link dScopeIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100392hi def link dTraitsIdentifier Identifier
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200393hi def link dPragma PreProc
394hi def link dPragmaIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100395hi def link dExtern dExternal
396hi def link dExternIdentifier Identifier
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100397
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200398" Marks contents of the asm statment body as special
399
400syn match dAsmStatement "\<asm\>"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200401syn region dAsmBody start="asm[\n]*\s*{"hs=e+1 end="}"he=e-1 contains=dAsmStatement,dAsmOpCode,@dComment,DUserLabel
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200402
403hi def link dAsmBody dUnicode
404hi def link dAsmStatement dStatement
405hi def link dAsmOpCode Identifier
406
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200407syn keyword dAsmOpCode contained aaa aad aam aas
408syn keyword dAsmOpCode contained add addpd addps addsd
409syn keyword dAsmOpCode contained and andnpd andnps andpd
410syn keyword dAsmOpCode contained arpl bound bsf bsr
411syn keyword dAsmOpCode contained bt btc btr bts
412syn keyword dAsmOpCode contained call bswap andps addss
413syn keyword dAsmOpCode contained cbw cdq clc cld
414syn keyword dAsmOpCode contained cli clts cmc cmova
415syn keyword dAsmOpCode contained cmovb cmovbe cmovc cmove
416syn keyword dAsmOpCode contained cmovge cmovl cmovle cmovna
417syn keyword dAsmOpCode contained cmovnae cmovg cmovae clflush
418syn keyword dAsmOpCode contained cmovnb cmovnbe cmovnc cmovne
419syn keyword dAsmOpCode contained cmovnge cmovnl cmovnle cmovno
420syn keyword dAsmOpCode contained cmovns cmovnz cmovo cmovp
421syn keyword dAsmOpCode contained cmovpo cmovs cmovz cmp
422syn keyword dAsmOpCode contained cmppd cmovpe cmovnp cmovng
423syn keyword dAsmOpCode contained cmpps cmps cmpsb cmpsd
424syn keyword dAsmOpCode contained cmpsw cmpxch8b cmpxchg comisd
425syn keyword dAsmOpCode contained cpuid cvtdq2pd cvtdq2ps cvtpd2dq
426syn keyword dAsmOpCode contained cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq
427syn keyword dAsmOpCode contained cvtps2pd cvtpd2pi comiss cmpss
428syn keyword dAsmOpCode contained cvtps2pi cvtsd2si cvtsd2ss cvtsi2sd
429syn keyword dAsmOpCode contained cvtss2sd cvtss2si cvttpd2dq cvttpd2pi
430syn keyword dAsmOpCode contained cvttps2pi cvttsd2si cvttss2si cwd
431syn keyword dAsmOpCode contained da daa das db
432syn keyword dAsmOpCode contained dd cwde cvttps2dq cvtsi2ss
433syn keyword dAsmOpCode contained de dec df di
434syn keyword dAsmOpCode contained divpd divps divsd divss
435syn keyword dAsmOpCode contained dq ds dt dw
436syn keyword dAsmOpCode contained enter f2xm1 fabs fadd
437syn keyword dAsmOpCode contained faddp emms dl div
438syn keyword dAsmOpCode contained fbld fbstp fchs fclex
439syn keyword dAsmOpCode contained fcmovbe fcmove fcmovnb fcmovnbe
440syn keyword dAsmOpCode contained fcmovnu fcmovu fcom fcomi
441syn keyword dAsmOpCode contained fcomp fcompp fcos fdecstp
442syn keyword dAsmOpCode contained fdisi fcomip fcmovne fcmovb
443syn keyword dAsmOpCode contained fdiv fdivp fdivr fdivrp
444syn keyword dAsmOpCode contained ffree fiadd ficom ficomp
445syn keyword dAsmOpCode contained fidivr fild fimul fincstp
446syn keyword dAsmOpCode contained fist fistp fisub fisubr
447syn keyword dAsmOpCode contained fld finit fidiv feni
448syn keyword dAsmOpCode contained fld1 fldcw fldenv fldl2e
449syn keyword dAsmOpCode contained fldlg2 fldln2 fldpi fldz
450syn keyword dAsmOpCode contained fmulp fnclex fndisi fneni
451syn keyword dAsmOpCode contained fnop fnsave fnstcw fnstenv
452syn keyword dAsmOpCode contained fnstsw fninit fmul fldl2t
453syn keyword dAsmOpCode contained fpatan fprem fprem1 fptan
454syn keyword dAsmOpCode contained frstor fsave fscale fsetpm
455syn keyword dAsmOpCode contained fsincos fsqrt fst fstcw
456syn keyword dAsmOpCode contained fstp fstsw fsub fsubp
457syn keyword dAsmOpCode contained fsubr fstenv fsin frndint
458syn keyword dAsmOpCode contained fsubrp ftst fucom fucomi
459syn keyword dAsmOpCode contained fucomp fucompp fwait fxam
460syn keyword dAsmOpCode contained fxrstor fxsave fxtract fyl2x
461syn keyword dAsmOpCode contained hlt idiv imul in
462syn keyword dAsmOpCode contained inc fyl2xp1 fxch fucomip
463syn keyword dAsmOpCode contained ins insb insd insw
464syn keyword dAsmOpCode contained into invd invlpg iret
465syn keyword dAsmOpCode contained ja jae jb jbe
466syn keyword dAsmOpCode contained jcxz je jecxz jg
467syn keyword dAsmOpCode contained jge jc iretd int
468syn keyword dAsmOpCode contained jl jle jmp jna
469syn keyword dAsmOpCode contained jnb jnbe jnc jne
470syn keyword dAsmOpCode contained jnge jnl jnle jno
471syn keyword dAsmOpCode contained jns jnz jo jp
472syn keyword dAsmOpCode contained jpe jnp jng jnae
473syn keyword dAsmOpCode contained jpo js jz lahf
474syn keyword dAsmOpCode contained ldmxcsr lds lea leave
475syn keyword dAsmOpCode contained lfence lfs lgdt lgs
476syn keyword dAsmOpCode contained lldt lmsw lock lods
477syn keyword dAsmOpCode contained lodsb lidt les lar
478syn keyword dAsmOpCode contained lodsd lodsw loop loope
479syn keyword dAsmOpCode contained loopnz loopz lsl lss
480syn keyword dAsmOpCode contained maskmovdqu maskmovq maxpd maxps
481syn keyword dAsmOpCode contained maxss mfence minpd minps
482syn keyword dAsmOpCode contained minsd maxsd ltr loopne
483syn keyword dAsmOpCode contained minss mov movapd movaps
484syn keyword dAsmOpCode contained movdq2q movdqa movdqu movhlps
485syn keyword dAsmOpCode contained movhps movlhps movlpd movlps
486syn keyword dAsmOpCode contained movmskps movntdq movnti movntpd
487syn keyword dAsmOpCode contained movntps movmskpd movhpd movd
488syn keyword dAsmOpCode contained movntq movq movq2dq movs
489syn keyword dAsmOpCode contained movsd movss movsw movsx
490syn keyword dAsmOpCode contained movups movzx mul mulpd
491syn keyword dAsmOpCode contained mulsd mulss neg nop
492syn keyword dAsmOpCode contained not mulps movupd movsb
493syn keyword dAsmOpCode contained or orpd orps out
494syn keyword dAsmOpCode contained outsb outsd outsw packssdw
495syn keyword dAsmOpCode contained packuswb paddb paddd paddq
496syn keyword dAsmOpCode contained paddsw paddusb paddusw paddw
497syn keyword dAsmOpCode contained pand paddsb packsswb outs
498syn keyword dAsmOpCode contained pandn pavgb pavgw pcmpeqb
499syn keyword dAsmOpCode contained pcmpeqw pcmpgtb pcmpgtd pcmpgtw
500syn keyword dAsmOpCode contained pinsrw pmaddwd pmaxsw pmaxub
501syn keyword dAsmOpCode contained pminub pmovmskb pmulhuw pmulhw
502syn keyword dAsmOpCode contained pmullw pminsw pextrw pcmpeqd
503syn keyword dAsmOpCode contained pmuludq pop popa popad
504syn keyword dAsmOpCode contained popfd por prefetchnta prefetcht0
505syn keyword dAsmOpCode contained prefetcht2 psadbw pshufd pshufhw
506syn keyword dAsmOpCode contained pshufw pslld pslldq psllq
507syn keyword dAsmOpCode contained psllw pshuflw prefetcht1 popf
508syn keyword dAsmOpCode contained psrad psraw psrld psrldq
509syn keyword dAsmOpCode contained psrlw psubb psubd psubq
510syn keyword dAsmOpCode contained psubsw psubusb psubusw psubw
511syn keyword dAsmOpCode contained punpckhdq punpckhqdq punpckhwd punpcklbw
512syn keyword dAsmOpCode contained punpckldq punpckhbw psubsb psrlq
513syn keyword dAsmOpCode contained punpcklqdq punpcklwd push pusha
514syn keyword dAsmOpCode contained pushf pushfd pxor rcl
515syn keyword dAsmOpCode contained rcpss rcr rdmsr rdpmc
516syn keyword dAsmOpCode contained rep repe repne repnz
517syn keyword dAsmOpCode contained repz rdtsc rcpps pushad
518syn keyword dAsmOpCode contained ret retf rol ror
519syn keyword dAsmOpCode contained rsqrtps rsqrtss sahf sal
520syn keyword dAsmOpCode contained sbb scas scasb scasd
521syn keyword dAsmOpCode contained seta setae setb setbe
522syn keyword dAsmOpCode contained setc scasw sar rsm
523syn keyword dAsmOpCode contained sete setg setge setl
524syn keyword dAsmOpCode contained setna setnae setnb setnbe
525syn keyword dAsmOpCode contained setne setng setnge setnl
526syn keyword dAsmOpCode contained setno setnp setns setnz
527syn keyword dAsmOpCode contained seto setnle setnc setle
528syn keyword dAsmOpCode contained setp setpe setpo sets
529syn keyword dAsmOpCode contained sfence sgdt shl shld
530syn keyword dAsmOpCode contained shrd shufpd shufps sidt
531syn keyword dAsmOpCode contained smsw sqrtpd sqrtps sqrtsd
532syn keyword dAsmOpCode contained sqrtss sldt shr setz
533syn keyword dAsmOpCode contained stc std sti stmxcsr
534syn keyword dAsmOpCode contained stosb stosd stosw str
535syn keyword dAsmOpCode contained subpd subps subsd subss
536syn keyword dAsmOpCode contained sysexit test ucomisd ucomiss
537syn keyword dAsmOpCode contained ud2 sysenter sub stos
538syn keyword dAsmOpCode contained unpckhpd unpckhps unpcklpd unpcklps
539syn keyword dAsmOpCode contained verw wbinvd wrmsr xadd
540syn keyword dAsmOpCode contained xchg xlatb xor xorpd
541syn keyword dAsmOpCode contained xorps pfrcpit1 pfmin movddup
542syn keyword dAsmOpCode contained addsubpd addsubps fisttp haddps
543syn keyword dAsmOpCode contained hsubpd hsubps lddqu monitor
544syn keyword dAsmOpCode contained haddpd xlat wait verr
545syn keyword dAsmOpCode contained movshdup movsldup mwait pfcmpeq
546syn keyword dAsmOpCode contained pavgusb pf2id pfacc pfadd
547syn keyword dAsmOpCode contained pfcmpge pfcmpgt pfmax pfmul
548syn keyword dAsmOpCode contained pfnacc pfpnacc pfrcp pfrcpit1
549syn keyword dAsmOpCode contained pfrsqit1 pfrsqrt pfsub pfsubr
550syn keyword dAsmOpCode contained pmulhrw pswapd syscall sysret
551syn keyword dAsmOpCode contained vpmuldq xgetbv cmpxchg8b cmpxchg16b
552syn keyword dAsmOpCode contained pabsb pabsd pabsw palignr
553syn keyword dAsmOpCode contained phaddd phaddsw phaddw phsubd
554syn keyword dAsmOpCode contained phsubsw phsubw pmaddubsw pmulhrsw
555syn keyword dAsmOpCode contained pshufb psignb psignd psignw
556syn keyword dAsmOpCode contained popfq pushfq blendpd blendps
557syn keyword dAsmOpCode contained blendvpd blendvps extractps insertps
558syn keyword dAsmOpCode contained movntdqa mpsadbw packusdw pblendvb
559syn keyword dAsmOpCode contained pblendw pcmpeqq pextrb pextrd
560syn keyword dAsmOpCode contained pextrq phminposuw pinsrb pinsrd
561syn keyword dAsmOpCode contained pinsrq pmaxsb pmaxsd pmaxud
562syn keyword dAsmOpCode contained pmaxuw pminsb pminsd pminud
563syn keyword dAsmOpCode contained pminuw pmulld ptest roundpd
564syn keyword dAsmOpCode contained roundps roundsd roundss pmuldq
565syn keyword dAsmOpCode contained pmovsxbd pmovsxdq pmovzxbq pmovzxdq
566syn keyword dAsmOpCode contained pmovsxbq pmovsxwd pmovzxbq pmovzxwd
567syn keyword dAsmOpCode contained pmovsxbw pmovsxwq pmovzxbw pmovzxwq
568syn keyword dAsmOpCode contained crc32 pcmpestri pcmpestrm pcmpgtq
569syn keyword dAsmOpCode contained pcmpistri pcmpistrm popcnt pi2fd
570syn keyword dAsmOpCode contained adc
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200571
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100572let &cpo = s:cpo_save
573unlet s:cpo_save