blob: 52c83bf913fc673629947a9f7b8783637dee6631 [file] [log] [blame]
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02001" Vim syntax file for the D programming language (version 1.076 and 2.063).
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 Moolenaarb1332082013-10-06 14:22:40 +02005" Last Change: 2013 October 5
6" Version: 0.26
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 Moolenaar9db9d9c2010-01-16 14:29:14 +010018"
Bram Moolenaar6be7f872012-01-20 21:08:56 +010019" Please submit bugs/comments/suggestions to the github repo:
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020020" https://github.com/JesseKPhillips/d.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000021"
22" Options:
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +010023" d_comment_strings - Set to highlight strings and numbers in comments.
Bram Moolenaar071d4272004-06-13 20:20:40 +000024"
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +010025" d_hl_operator_overload - Set to highlight D's specially named functions
26" that when overloaded implement unary and binary operators (e.g. opCmp).
Bram Moolenaar071d4272004-06-13 20:20:40 +000027"
Bram Moolenaar6be7f872012-01-20 21:08:56 +010028" d_hl_object_types - Set to highlight some common types from object.di.
Bram Moolenaar071d4272004-06-13 20:20:40 +000029
30" Quit when a syntax file was already loaded
31if exists("b:current_syntax")
32 finish
33endif
34
Bram Moolenaar6be7f872012-01-20 21:08:56 +010035" Support cpoptions
36let s:cpo_save = &cpo
37set cpo&vim
38
39" Set the current syntax to be known as d
40let b:current_syntax = "d"
41
Bram Moolenaar071d4272004-06-13 20:20:40 +000042" Keyword definitions
43"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020044syn keyword dExternal contained import module
45syn keyword dAssert assert
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020046syn keyword dConditional if else switch
47syn keyword dBranch goto break continue
48syn keyword dRepeat while for do foreach foreach_reverse
49syn keyword dBoolean true false
50syn keyword dConstant null
51syn keyword dConstant __FILE__ __LINE__ __EOF__ __VERSION__
52syn keyword dConstant __DATE__ __TIME__ __TIMESTAMP__ __VENDOR__
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020053syn keyword dConstant __MODULE__ __FUNCTION__ __PRETTY_FUNCTION__
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020054syn keyword dTypedef alias typedef
55syn keyword dStructure template interface class struct union
56syn keyword dEnum enum
57syn keyword dOperator new delete typeof typeid cast align is
58syn keyword dOperator this super
Bram Moolenaar071d4272004-06-13 20:20:40 +000059if exists("d_hl_operator_overload")
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020060 syn keyword dOpOverload opNeg opCom opPostInc opPostDec opCast opAdd
61 syn keyword dOpOverload opSub opSub_r opMul opDiv opDiv_r opMod
62 syn keyword dOpOverload opMod_r opAnd opOr opXor opShl opShl_r opShr
63 syn keyword dOpOverload opShr_r opUShr opUShr_r opCat
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020064 syn keyword dOpOverload opCat_r opEquals opCmp
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020065 syn keyword dOpOverload opAssign opAddAssign opSubAssign opMulAssign
66 syn keyword dOpOverload opDivAssign opModAssign opAndAssign
67 syn keyword dOpOverload opOrAssign opXorAssign opShlAssign
68 syn keyword dOpOverload opShrAssign opUShrAssign opCatAssign
69 syn keyword dOpOverload opIndex opIndexAssign opIndexOpAssign
70 syn keyword dOpOverload opCall opSlice opSliceAssign opSliceOpAssign
71 syn keyword dOpOverload opPos opAdd_r opMul_r opAnd_r opOr_r opXor_r
72 syn keyword dOpOverload opIn opIn_r opPow opDispatch opStar opDot
Bram Moolenaar6be7f872012-01-20 21:08:56 +010073 syn keyword dOpOverload opApply opApplyReverse opDollar
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020074 syn keyword dOpOverload opUnary opIndexUnary opSliceUnary
75 syn keyword dOpOverload opBinary opBinaryRight
Bram Moolenaar071d4272004-06-13 20:20:40 +000076endif
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020077
Bram Moolenaar6be7f872012-01-20 21:08:56 +010078syn keyword dType byte ubyte short ushort int uint long ulong cent ucent
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020079syn keyword dType void bool Object
Bram Moolenaar6be7f872012-01-20 21:08:56 +010080syn keyword dType float double real
81syn keyword dType ushort int uint long ulong float
82syn keyword dType char wchar dchar string wstring dstring
83syn keyword dType ireal ifloat idouble creal cfloat cdouble
84syn keyword dType size_t ptrdiff_t sizediff_t equals_t hash_t
85if exists("d_hl_object_types")
86 syn keyword dType Object Throwable AssociativeArray Error Exception
87 syn keyword dType Interface OffsetTypeInfo TypeInfo TypeInfo_Typedef
88 syn keyword dType TypeInfo_Enum TypeInfo_Pointer TypeInfo_Array
89 syn keyword dType TypeInfo_StaticArray TypeInfo_AssociativeArray
90 syn keyword dType TypeInfo_Function TypeInfo_Delegate TypeInfo_Class
91 syn keyword dType ClassInfo TypeInfo_Interface TypeInfo_Struct
92 syn keyword dType TypeInfo_Tuple TypeInfo_Const TypeInfo_Invariant
93 syn keyword dType TypeInfo_Shared TypeInfo_Inout MemberInfo
94 syn keyword dType MemberInfo_field MemberInfo_function ModuleInfo
95endif
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020096syn keyword dDebug deprecated unittest invariant
97syn keyword dExceptions throw try catch finally
Bram Moolenaar6be7f872012-01-20 21:08:56 +010098syn keyword dScopeDecl public protected private export package
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020099syn keyword dStatement debug return with
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200100syn keyword dStatement function delegate __ctfe mixin macro __simd
101syn keyword dStatement in out body
102syn keyword dStorageClass contained in out scope
103syn keyword dStorageClass inout ref lazy pure nothrow
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200104syn keyword dStorageClass auto static override final abstract volatile
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200105syn keyword dStorageClass __gshared __vector
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200106syn keyword dStorageClass synchronized shared immutable const lazy
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200107syn keyword dIdentifier _arguments _argptr __vptr __monitor
108syn keyword dIdentifier _ctor _dtor __argTypes __overloadset
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200109syn keyword dScopeIdentifier contained exit success failure
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200110syn keyword dTraitsIdentifier contained isAbstractClass isArithmetic
111syn keyword dTraitsIdentifier contained isAssociativeArray isFinalClass
112syn keyword dTraitsIdentifier contained isPOD isNested isFloating
113syn keyword dTraitsIdentifier contained isIntegral isScalar isStaticArray
114syn keyword dTraitsIdentifier contained isUnsigned isVirtualFunction
115syn keyword dTraitsIdentifier contained isVirtualMethod isAbstractFunction
116syn keyword dTraitsIdentifier contained isFinalFunction isStaticFunction
117syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember
118syn keyword dTraitsIdentifier contained identifier getAttributes getMember
119syn keyword dTraitsIdentifier contained getOverloads getProtection
120syn keyword dTraitsIdentifier contained getVirtualFunctions
121syn keyword dTraitsIdentifier contained getVirtualMethods parent
122syn keyword dTraitsIdentifier contained classInstanceSize allMembers
123syn keyword dTraitsIdentifier contained derivedMembers isSame compiles
124syn keyword dPragmaIdentifier contained lib msg startaddress GNU_asm
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100125syn keyword dExternIdentifier contained Windows Pascal Java System D
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200126syn keyword dAttribute contained safe trusted system
127syn keyword dAttribute contained property disable
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100128syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET
129syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha
130syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64
131syn keyword dVersionIdentifier contained linux Posix OSX FreeBSD Windows Win32 Win64
132syn keyword dVersionIdentifier contained OpenBSD BSD Solaris AIX SkyOS SysV3 SysV4 Hurd
133syn keyword dVersionIdentifier contained Cygwin MinGW
134syn keyword dVersionIdentifier contained LittleEndian BigEndian
135syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64
136syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC
137syn keyword dVersionIdentifier contained unittest none all
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200138
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200139syn cluster dComment contains=dNestedComment,dBlockComment,dLineComment
140
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200141" Highlight the sharpbang
142syn match dSharpBang "\%^#!.*" display
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100144" Attributes/annotations
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200145syn match dAnnotation "@[_$a-zA-Z][_$a-zA-Z0-9_]*\>" contains=dAttribute
146
147" Version Identifiers
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200148syn match dVersion "\<version\>"
149syn match dVersion "\<version\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+7 contains=dVersionIdentifier
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200150
151" Scope Identifiers
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200152syn match dStatement "\<scope\>"
153syn match dStatement "\<scope\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+5 contains=dScopeIdentifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100154
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200155" Traits Statement
156syn match dStatement "\<__traits\>"
157syn match dStatement "\<__traits\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+8 contains=dTraitsIdentifier
158
159" Pragma Statement
160syn match dPragma "\<pragma\>"
Bram Moolenaarb1332082013-10-06 14:22:40 +0200161syn match dPragma "\<pragma\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+6 contains=dPragmaIdentifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100162
163" Necessary to highlight C++ in extern modifiers.
164syn match dExternIdentifier "C\(++\)\?" contained
165
166" Extern Identifiers
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200167syn match dExternal "\<extern\>"
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100168syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200169
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200170" Make import a region to prevent highlighting keywords
Bram Moolenaarb1332082013-10-06 14:22:40 +0200171syn region dImport start="import\_s" end=";" contains=dExternal,@dComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000172
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200173" Make module a region to prevent highlighting keywords
Bram Moolenaarb1332082013-10-06 14:22:40 +0200174syn region dImport start="module\_s" end=";" contains=dExternal,@dComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100176" dTokens is used by the token string highlighting
177syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean
178syn cluster dTokens add=dConstant,dTypedef,dStructure,dOperator,dOpOverload
179syn cluster dTokens add=dType,dDebug,dExceptions,dScopeDecl,dStatement
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200180syn cluster dTokens add=dStorageClass,dPragma,dAssert,dAnnotation,dEnum
Bram Moolenaarb1332082013-10-06 14:22:40 +0200181syn cluster dTokens add=dParenString,dBrackString,dAngleString,dCurlyString
182syn cluster dTokens add=dTokenString,dDelimString,dHereString
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100183
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200184" Create a match for parameter lists to identify storage class
185syn region paramlist start="(" end=")" contains=@dTokens
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186
187" Labels
188"
189" We contain dScopeDecl so public: private: etc. are not highlighted like labels
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100190syn 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 +0200191syn keyword dLabel case default
Bram Moolenaar071d4272004-06-13 20:20:40 +0000192
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100193syn cluster dTokens add=dUserLabel,dLabel
194
Bram Moolenaar071d4272004-06-13 20:20:40 +0000195" Comments
196"
Bram Moolenaarb1332082013-10-06 14:22:40 +0200197syn match dCommentError display "\*/"
198syn match dNestedCommentError display "+/"
199
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200200syn keyword dTodo contained TODO FIXME TEMP REFACTOR REVIEW HACK BUG XXX
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000201syn match dCommentStar contained "^\s*\*[^/]"me=e-1
202syn match dCommentStar contained "^\s*\*$"
203syn match dCommentPlus contained "^\s*+[^/]"me=e-1
204syn match dCommentPlus contained "^\s*+$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000205if exists("d_comment_strings")
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000206 syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell
207 syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell
208 syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000209endif
210
Bram Moolenaarb1332082013-10-06 14:22:40 +0200211syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,dCommentStartError,@Spell fold
212syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold
213syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
214
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000215hi link dLineCommentString dBlockCommentString
216hi link dBlockCommentString dString
217hi link dNestedCommentString dString
218hi link dCommentStar dBlockComment
219hi link dCommentPlus dNestedComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100221syn cluster dTokens add=dBlockComment,dNestedComment,dLineComment
222
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000223" /+ +/ style comments and strings that span multiple lines can cause
224" problems. To play it safe, set minlines to a large number.
225syn sync minlines=200
226" Use ccomment for /* */ style comments
227syn sync ccomment dBlockComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000228
229" Characters
230"
231syn match dSpecialCharError contained "[^']"
232
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000233" Escape sequences (oct,specal char,hex,wchar, character entities \&xxx;)
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100234" These are not contained because they are considered string literals.
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000235syn match dEscSequence "\\\(\o\{1,3}\|[\"\\'\\?ntbrfva]\|u\x\{4}\|U\x\{8}\|x\x\x\)"
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100236syn match dEscSequence "\\&[^;& \t]\+;"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000237syn match dCharacter "'[^']*'" contains=dEscSequence,dSpecialCharError
238syn match dCharacter "'\\''" contains=dEscSequence
239syn match dCharacter "'[^\\]'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000240
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100241syn cluster dTokens add=dEscSequence,dCharacter
242
Bram Moolenaar071d4272004-06-13 20:20:40 +0000243" Unicode characters
244"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000245syn match dUnicode "\\u\d\{4\}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000246
247" String.
248"
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100249syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dEscSequence,@Spell
250syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell
251syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell
252syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell
253syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell
Bram Moolenaarb1332082013-10-06 14:22:40 +0200254syn region dHereString start=+q"\z(\I\i*\)\n+ end=+^\z1"+ contains=@Spell
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100255
256" Nesting delimited string contents
257"
258syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell
259syn region dNestBrackString start=+\[+ end=+\]+ contained transparent contains=dNestBrackString,@Spell
260syn region dNestAngleString start=+<+ end=+>+ contained transparent contains=dNestAngleString,@Spell
261syn region dNestCurlyString start=+{+ end=+}+ contained transparent contains=dNestCurlyString,@Spell
262
263" Nesting delimited strings
264"
265syn region dParenString matchgroup=dParenString start=+q"(+ end=+)"+ contains=dNestParenString,@Spell
266syn region dBrackString matchgroup=dBrackString start=+q"\[+ end=+\]"+ contains=dNestBrackString,@Spell
267syn region dAngleString matchgroup=dAngleString start=+q"<+ end=+>"+ contains=dNestAngleString,@Spell
268syn region dCurlyString matchgroup=dCurlyString start=+q"{+ end=+}"+ contains=dNestCurlyString,@Spell
269
270hi link dParenString dNestString
271hi link dBrackString dNestString
272hi link dAngleString dNestString
273hi link dCurlyString dNestString
274
275syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString
276
277" Token strings
278"
279syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens
280syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens
281
282syn cluster dTokens add=dTokenString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000283
284" Numbers
285"
286syn case ignore
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000287
288syn match dDec display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>"
289
Bram Moolenaar071d4272004-06-13 20:20:40 +0000290" Hex number
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000291syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>"
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000292
293syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>"
294" flag an octal number with wrong digits
295syn match dOctalError display "\<0[0-7_]*[89][0-9_]*"
296
297" binary numbers
298syn match dBinary display "\<0b[01_]\+\(u\=l\=\|l\=u\=\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000299
300"floating point without the dot
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000301syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302"floating point number, with dot, optional exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000303syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\="
Bram Moolenaar071d4272004-06-13 20:20:40 +0000304"floating point number, starting with a dot, optional exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000305syn match dFloat display "\(\.[0-9_]\+\)\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000306"floating point number, without dot, with exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000307"syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>"
308syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000309
310"floating point without the dot
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000311syn match dHexFloat display "\<0x[0-9a-f_]\+\(fi\=\|l\=i\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000312"floating point number, with dot, optional exponent
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000313syn match dHexFloat display "\<0x[0-9a-f_]\+\.[0-9a-f_]*\(p[-+]\=[0-9_]\+\)\=[fl]\=i\="
Bram Moolenaar071d4272004-06-13 20:20:40 +0000314"floating point number, without dot, with exponent
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000315syn match dHexFloat display "\<0x[0-9a-f_]\+p[-+]\=[0-9_]\+[fl]\=i\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000316
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100317syn cluster dTokens add=dDec,dHex,dOctal,dOctalError,dBinary,dFloat,dHexFloat
318
Bram Moolenaar071d4272004-06-13 20:20:40 +0000319syn case match
320
321" Pragma (preprocessor) support
322" TODO: Highlight following Integer and optional Filespec.
323syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$"
324
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100325" Block
326"
327syn region dBlock start="{" end="}" transparent fold
328
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329
330" The default highlighting.
331"
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200332hi def link dBinary Number
333hi def link dDec Number
334hi def link dHex Number
335hi def link dOctal Number
336hi def link dFloat Float
337hi def link dHexFloat Float
338hi def link dDebug Debug
339hi def link dBranch Conditional
340hi def link dConditional Conditional
341hi def link dLabel Label
342hi def link dUserLabel Label
343hi def link dRepeat Repeat
344hi def link dExceptions Exception
345hi def link dAssert Statement
346hi def link dStatement Statement
347hi def link dScopeDecl dStorageClass
348hi def link dStorageClass StorageClass
349hi def link dBoolean Boolean
350hi def link dUnicode Special
351hi def link dTokenStringBrack String
352hi def link dHereString String
353hi def link dNestString String
354hi def link dDelimString String
355hi def link dRawString String
356hi def link dString String
357hi def link dHexString String
358hi def link dCharacter Character
359hi def link dEscSequence SpecialChar
360hi def link dSpecialCharError Error
361hi def link dOctalError Error
362hi def link dOperator Operator
363hi def link dOpOverload Identifier
364hi def link dConstant Constant
365hi def link dTypedef Typedef
366hi def link dEnum Structure
367hi def link dStructure Structure
368hi def link dTodo Todo
369hi def link dType Type
370hi def link dLineComment Comment
371hi def link dBlockComment Comment
372hi def link dNestedComment Comment
Bram Moolenaarb1332082013-10-06 14:22:40 +0200373hi def link dCommentError Error
374hi def link dNestedCommentError Error
375hi def link dCommentStartError Error
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200376hi def link dExternal Include
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200377hi def link dAnnotation PreProc
378hi def link dSharpBang PreProc
379hi def link dAttribute StorageClass
380hi def link dIdentifier Identifier
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200381hi def link dVersion dStatement
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100382hi def link dVersionIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100383hi def link dScopeIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100384hi def link dTraitsIdentifier Identifier
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200385hi def link dPragma PreProc
386hi def link dPragmaIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100387hi def link dExtern dExternal
388hi def link dExternIdentifier Identifier
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100389
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200390" Marks contents of the asm statment body as special
391
392syn match dAsmStatement "\<asm\>"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200393syn 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 +0200394
395hi def link dAsmBody dUnicode
396hi def link dAsmStatement dStatement
397hi def link dAsmOpCode Identifier
398
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200399syn keyword dAsmOpCode contained aaa aad aam aas
400syn keyword dAsmOpCode contained add addpd addps addsd
401syn keyword dAsmOpCode contained and andnpd andnps andpd
402syn keyword dAsmOpCode contained arpl bound bsf bsr
403syn keyword dAsmOpCode contained bt btc btr bts
404syn keyword dAsmOpCode contained call bswap andps addss
405syn keyword dAsmOpCode contained cbw cdq clc cld
406syn keyword dAsmOpCode contained cli clts cmc cmova
407syn keyword dAsmOpCode contained cmovb cmovbe cmovc cmove
408syn keyword dAsmOpCode contained cmovge cmovl cmovle cmovna
409syn keyword dAsmOpCode contained cmovnae cmovg cmovae clflush
410syn keyword dAsmOpCode contained cmovnb cmovnbe cmovnc cmovne
411syn keyword dAsmOpCode contained cmovnge cmovnl cmovnle cmovno
412syn keyword dAsmOpCode contained cmovns cmovnz cmovo cmovp
413syn keyword dAsmOpCode contained cmovpo cmovs cmovz cmp
414syn keyword dAsmOpCode contained cmppd cmovpe cmovnp cmovng
415syn keyword dAsmOpCode contained cmpps cmps cmpsb cmpsd
416syn keyword dAsmOpCode contained cmpsw cmpxch8b cmpxchg comisd
417syn keyword dAsmOpCode contained cpuid cvtdq2pd cvtdq2ps cvtpd2dq
418syn keyword dAsmOpCode contained cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq
419syn keyword dAsmOpCode contained cvtps2pd cvtpd2pi comiss cmpss
420syn keyword dAsmOpCode contained cvtps2pi cvtsd2si cvtsd2ss cvtsi2sd
421syn keyword dAsmOpCode contained cvtss2sd cvtss2si cvttpd2dq cvttpd2pi
422syn keyword dAsmOpCode contained cvttps2pi cvttsd2si cvttss2si cwd
423syn keyword dAsmOpCode contained da daa das db
424syn keyword dAsmOpCode contained dd cwde cvttps2dq cvtsi2ss
425syn keyword dAsmOpCode contained de dec df di
426syn keyword dAsmOpCode contained divpd divps divsd divss
427syn keyword dAsmOpCode contained dq ds dt dw
428syn keyword dAsmOpCode contained enter f2xm1 fabs fadd
429syn keyword dAsmOpCode contained faddp emms dl div
430syn keyword dAsmOpCode contained fbld fbstp fchs fclex
431syn keyword dAsmOpCode contained fcmovbe fcmove fcmovnb fcmovnbe
432syn keyword dAsmOpCode contained fcmovnu fcmovu fcom fcomi
433syn keyword dAsmOpCode contained fcomp fcompp fcos fdecstp
434syn keyword dAsmOpCode contained fdisi fcomip fcmovne fcmovb
435syn keyword dAsmOpCode contained fdiv fdivp fdivr fdivrp
436syn keyword dAsmOpCode contained ffree fiadd ficom ficomp
437syn keyword dAsmOpCode contained fidivr fild fimul fincstp
438syn keyword dAsmOpCode contained fist fistp fisub fisubr
439syn keyword dAsmOpCode contained fld finit fidiv feni
440syn keyword dAsmOpCode contained fld1 fldcw fldenv fldl2e
441syn keyword dAsmOpCode contained fldlg2 fldln2 fldpi fldz
442syn keyword dAsmOpCode contained fmulp fnclex fndisi fneni
443syn keyword dAsmOpCode contained fnop fnsave fnstcw fnstenv
444syn keyword dAsmOpCode contained fnstsw fninit fmul fldl2t
445syn keyword dAsmOpCode contained fpatan fprem fprem1 fptan
446syn keyword dAsmOpCode contained frstor fsave fscale fsetpm
447syn keyword dAsmOpCode contained fsincos fsqrt fst fstcw
448syn keyword dAsmOpCode contained fstp fstsw fsub fsubp
449syn keyword dAsmOpCode contained fsubr fstenv fsin frndint
450syn keyword dAsmOpCode contained fsubrp ftst fucom fucomi
451syn keyword dAsmOpCode contained fucomp fucompp fwait fxam
452syn keyword dAsmOpCode contained fxrstor fxsave fxtract fyl2x
453syn keyword dAsmOpCode contained hlt idiv imul in
454syn keyword dAsmOpCode contained inc fyl2xp1 fxch fucomip
455syn keyword dAsmOpCode contained ins insb insd insw
456syn keyword dAsmOpCode contained into invd invlpg iret
457syn keyword dAsmOpCode contained ja jae jb jbe
458syn keyword dAsmOpCode contained jcxz je jecxz jg
459syn keyword dAsmOpCode contained jge jc iretd int
460syn keyword dAsmOpCode contained jl jle jmp jna
461syn keyword dAsmOpCode contained jnb jnbe jnc jne
462syn keyword dAsmOpCode contained jnge jnl jnle jno
463syn keyword dAsmOpCode contained jns jnz jo jp
464syn keyword dAsmOpCode contained jpe jnp jng jnae
465syn keyword dAsmOpCode contained jpo js jz lahf
466syn keyword dAsmOpCode contained ldmxcsr lds lea leave
467syn keyword dAsmOpCode contained lfence lfs lgdt lgs
468syn keyword dAsmOpCode contained lldt lmsw lock lods
469syn keyword dAsmOpCode contained lodsb lidt les lar
470syn keyword dAsmOpCode contained lodsd lodsw loop loope
471syn keyword dAsmOpCode contained loopnz loopz lsl lss
472syn keyword dAsmOpCode contained maskmovdqu maskmovq maxpd maxps
473syn keyword dAsmOpCode contained maxss mfence minpd minps
474syn keyword dAsmOpCode contained minsd maxsd ltr loopne
475syn keyword dAsmOpCode contained minss mov movapd movaps
476syn keyword dAsmOpCode contained movdq2q movdqa movdqu movhlps
477syn keyword dAsmOpCode contained movhps movlhps movlpd movlps
478syn keyword dAsmOpCode contained movmskps movntdq movnti movntpd
479syn keyword dAsmOpCode contained movntps movmskpd movhpd movd
480syn keyword dAsmOpCode contained movntq movq movq2dq movs
481syn keyword dAsmOpCode contained movsd movss movsw movsx
482syn keyword dAsmOpCode contained movups movzx mul mulpd
483syn keyword dAsmOpCode contained mulsd mulss neg nop
484syn keyword dAsmOpCode contained not mulps movupd movsb
485syn keyword dAsmOpCode contained or orpd orps out
486syn keyword dAsmOpCode contained outsb outsd outsw packssdw
487syn keyword dAsmOpCode contained packuswb paddb paddd paddq
488syn keyword dAsmOpCode contained paddsw paddusb paddusw paddw
489syn keyword dAsmOpCode contained pand paddsb packsswb outs
490syn keyword dAsmOpCode contained pandn pavgb pavgw pcmpeqb
491syn keyword dAsmOpCode contained pcmpeqw pcmpgtb pcmpgtd pcmpgtw
492syn keyword dAsmOpCode contained pinsrw pmaddwd pmaxsw pmaxub
493syn keyword dAsmOpCode contained pminub pmovmskb pmulhuw pmulhw
494syn keyword dAsmOpCode contained pmullw pminsw pextrw pcmpeqd
495syn keyword dAsmOpCode contained pmuludq pop popa popad
496syn keyword dAsmOpCode contained popfd por prefetchnta prefetcht0
497syn keyword dAsmOpCode contained prefetcht2 psadbw pshufd pshufhw
498syn keyword dAsmOpCode contained pshufw pslld pslldq psllq
499syn keyword dAsmOpCode contained psllw pshuflw prefetcht1 popf
500syn keyword dAsmOpCode contained psrad psraw psrld psrldq
501syn keyword dAsmOpCode contained psrlw psubb psubd psubq
502syn keyword dAsmOpCode contained psubsw psubusb psubusw psubw
503syn keyword dAsmOpCode contained punpckhdq punpckhqdq punpckhwd punpcklbw
504syn keyword dAsmOpCode contained punpckldq punpckhbw psubsb psrlq
505syn keyword dAsmOpCode contained punpcklqdq punpcklwd push pusha
506syn keyword dAsmOpCode contained pushf pushfd pxor rcl
507syn keyword dAsmOpCode contained rcpss rcr rdmsr rdpmc
508syn keyword dAsmOpCode contained rep repe repne repnz
509syn keyword dAsmOpCode contained repz rdtsc rcpps pushad
510syn keyword dAsmOpCode contained ret retf rol ror
511syn keyword dAsmOpCode contained rsqrtps rsqrtss sahf sal
512syn keyword dAsmOpCode contained sbb scas scasb scasd
513syn keyword dAsmOpCode contained seta setae setb setbe
514syn keyword dAsmOpCode contained setc scasw sar rsm
515syn keyword dAsmOpCode contained sete setg setge setl
516syn keyword dAsmOpCode contained setna setnae setnb setnbe
517syn keyword dAsmOpCode contained setne setng setnge setnl
518syn keyword dAsmOpCode contained setno setnp setns setnz
519syn keyword dAsmOpCode contained seto setnle setnc setle
520syn keyword dAsmOpCode contained setp setpe setpo sets
521syn keyword dAsmOpCode contained sfence sgdt shl shld
522syn keyword dAsmOpCode contained shrd shufpd shufps sidt
523syn keyword dAsmOpCode contained smsw sqrtpd sqrtps sqrtsd
524syn keyword dAsmOpCode contained sqrtss sldt shr setz
525syn keyword dAsmOpCode contained stc std sti stmxcsr
526syn keyword dAsmOpCode contained stosb stosd stosw str
527syn keyword dAsmOpCode contained subpd subps subsd subss
528syn keyword dAsmOpCode contained sysexit test ucomisd ucomiss
529syn keyword dAsmOpCode contained ud2 sysenter sub stos
530syn keyword dAsmOpCode contained unpckhpd unpckhps unpcklpd unpcklps
531syn keyword dAsmOpCode contained verw wbinvd wrmsr xadd
532syn keyword dAsmOpCode contained xchg xlatb xor xorpd
533syn keyword dAsmOpCode contained xorps pfrcpit1 pfmin movddup
534syn keyword dAsmOpCode contained addsubpd addsubps fisttp haddps
535syn keyword dAsmOpCode contained hsubpd hsubps lddqu monitor
536syn keyword dAsmOpCode contained haddpd xlat wait verr
537syn keyword dAsmOpCode contained movshdup movsldup mwait pfcmpeq
538syn keyword dAsmOpCode contained pavgusb pf2id pfacc pfadd
539syn keyword dAsmOpCode contained pfcmpge pfcmpgt pfmax pfmul
540syn keyword dAsmOpCode contained pfnacc pfpnacc pfrcp pfrcpit1
541syn keyword dAsmOpCode contained pfrsqit1 pfrsqrt pfsub pfsubr
542syn keyword dAsmOpCode contained pmulhrw pswapd syscall sysret
543syn keyword dAsmOpCode contained vpmuldq xgetbv cmpxchg8b cmpxchg16b
544syn keyword dAsmOpCode contained pabsb pabsd pabsw palignr
545syn keyword dAsmOpCode contained phaddd phaddsw phaddw phsubd
546syn keyword dAsmOpCode contained phsubsw phsubw pmaddubsw pmulhrsw
547syn keyword dAsmOpCode contained pshufb psignb psignd psignw
548syn keyword dAsmOpCode contained popfq pushfq blendpd blendps
549syn keyword dAsmOpCode contained blendvpd blendvps extractps insertps
550syn keyword dAsmOpCode contained movntdqa mpsadbw packusdw pblendvb
551syn keyword dAsmOpCode contained pblendw pcmpeqq pextrb pextrd
552syn keyword dAsmOpCode contained pextrq phminposuw pinsrb pinsrd
553syn keyword dAsmOpCode contained pinsrq pmaxsb pmaxsd pmaxud
554syn keyword dAsmOpCode contained pmaxuw pminsb pminsd pminud
555syn keyword dAsmOpCode contained pminuw pmulld ptest roundpd
556syn keyword dAsmOpCode contained roundps roundsd roundss pmuldq
557syn keyword dAsmOpCode contained pmovsxbd pmovsxdq pmovzxbq pmovzxdq
558syn keyword dAsmOpCode contained pmovsxbq pmovsxwd pmovzxbq pmovzxwd
559syn keyword dAsmOpCode contained pmovsxbw pmovsxwq pmovzxbw pmovzxwq
560syn keyword dAsmOpCode contained crc32 pcmpestri pcmpestrm pcmpgtq
561syn keyword dAsmOpCode contained pcmpistri pcmpistrm popcnt pi2fd
562syn keyword dAsmOpCode contained adc
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200563
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100564let &cpo = s:cpo_save
565unlet s:cpo_save