blob: 65408643d5e817863167d30e13aa1c3872be7c50 [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 Moolenaar543b7ef2013-06-01 14:50:56 +02005" Last Change: 2013 May 21
6" Version: 0.25
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\>"
161syn match dPragma "\<pragma\s*([_a-zA-Z][_a-zA-Z0-9]*\>"he=s+8 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
171syn region dImport start="import" 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
174syn region dImport start="module" 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 Moolenaar9db9d9c2010-01-16 14:29:14 +0100181
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200182" Create a match for parameter lists to identify storage class
183syn region paramlist start="(" end=")" contains=@dTokens
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184
185" Labels
186"
187" We contain dScopeDecl so public: private: etc. are not highlighted like labels
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100188syn 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 +0200189syn keyword dLabel case default
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100191syn cluster dTokens add=dUserLabel,dLabel
192
Bram Moolenaar071d4272004-06-13 20:20:40 +0000193" Comments
194"
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200195syn keyword dTodo contained TODO FIXME TEMP REFACTOR REVIEW HACK BUG XXX
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000196syn match dCommentStar contained "^\s*\*[^/]"me=e-1
197syn match dCommentStar contained "^\s*\*$"
198syn match dCommentPlus contained "^\s*+[^/]"me=e-1
199syn match dCommentPlus contained "^\s*+$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200if exists("d_comment_strings")
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000201 syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell
202 syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell
203 syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100204 syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell fold
205 syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000206 syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207else
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100208 syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell fold
209 syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell fold
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000210 syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211endif
212
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000213hi link dLineCommentString dBlockCommentString
214hi link dBlockCommentString dString
215hi link dNestedCommentString dString
216hi link dCommentStar dBlockComment
217hi link dCommentPlus dNestedComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000218
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100219syn cluster dTokens add=dBlockComment,dNestedComment,dLineComment
220
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000221" /+ +/ style comments and strings that span multiple lines can cause
222" problems. To play it safe, set minlines to a large number.
223syn sync minlines=200
224" Use ccomment for /* */ style comments
225syn sync ccomment dBlockComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226
227" Characters
228"
229syn match dSpecialCharError contained "[^']"
230
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000231" Escape sequences (oct,specal char,hex,wchar, character entities \&xxx;)
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100232" These are not contained because they are considered string literals.
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000233syn match dEscSequence "\\\(\o\{1,3}\|[\"\\'\\?ntbrfva]\|u\x\{4}\|U\x\{8}\|x\x\x\)"
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100234syn match dEscSequence "\\&[^;& \t]\+;"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000235syn match dCharacter "'[^']*'" contains=dEscSequence,dSpecialCharError
236syn match dCharacter "'\\''" contains=dEscSequence
237syn match dCharacter "'[^\\]'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100239syn cluster dTokens add=dEscSequence,dCharacter
240
Bram Moolenaar071d4272004-06-13 20:20:40 +0000241" Unicode characters
242"
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000243syn match dUnicode "\\u\d\{4\}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244
245" String.
246"
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100247syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dEscSequence,@Spell
248syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell
249syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell
250syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell
251syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell
252syn region dHereString start=+q"\z(\I\i*\)\n+ end=+\n\z1"+ contains=@Spell
253
254" Nesting delimited string contents
255"
256syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell
257syn region dNestBrackString start=+\[+ end=+\]+ contained transparent contains=dNestBrackString,@Spell
258syn region dNestAngleString start=+<+ end=+>+ contained transparent contains=dNestAngleString,@Spell
259syn region dNestCurlyString start=+{+ end=+}+ contained transparent contains=dNestCurlyString,@Spell
260
261" Nesting delimited strings
262"
263syn region dParenString matchgroup=dParenString start=+q"(+ end=+)"+ contains=dNestParenString,@Spell
264syn region dBrackString matchgroup=dBrackString start=+q"\[+ end=+\]"+ contains=dNestBrackString,@Spell
265syn region dAngleString matchgroup=dAngleString start=+q"<+ end=+>"+ contains=dNestAngleString,@Spell
266syn region dCurlyString matchgroup=dCurlyString start=+q"{+ end=+}"+ contains=dNestCurlyString,@Spell
267
268hi link dParenString dNestString
269hi link dBrackString dNestString
270hi link dAngleString dNestString
271hi link dCurlyString dNestString
272
273syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString
274
275" Token strings
276"
277syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens
278syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens
279
280syn cluster dTokens add=dTokenString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000281
282" Numbers
283"
284syn case ignore
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000285
286syn match dDec display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>"
287
Bram Moolenaar071d4272004-06-13 20:20:40 +0000288" Hex number
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000289syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>"
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000290
291syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>"
292" flag an octal number with wrong digits
293syn match dOctalError display "\<0[0-7_]*[89][0-9_]*"
294
295" binary numbers
296syn match dBinary display "\<0b[01_]\+\(u\=l\=\|l\=u\=\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297
298"floating point without the dot
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000299syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000300"floating point number, with dot, optional exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000301syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\="
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302"floating point number, starting with a dot, optional exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000303syn match dFloat display "\(\.[0-9_]\+\)\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000304"floating point number, without dot, with exponent
Bram Moolenaar21cf8232004-07-16 20:18:37 +0000305"syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>"
306syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000307
308"floating point without the dot
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000309syn match dHexFloat display "\<0x[0-9a-f_]\+\(fi\=\|l\=i\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000310"floating point number, with dot, optional exponent
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000311syn match dHexFloat display "\<0x[0-9a-f_]\+\.[0-9a-f_]*\(p[-+]\=[0-9_]\+\)\=[fl]\=i\="
Bram Moolenaar071d4272004-06-13 20:20:40 +0000312"floating point number, without dot, with exponent
Bram Moolenaar5baddf02006-03-12 21:53:56 +0000313syn match dHexFloat display "\<0x[0-9a-f_]\+p[-+]\=[0-9_]\+[fl]\=i\=\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000314
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100315syn cluster dTokens add=dDec,dHex,dOctal,dOctalError,dBinary,dFloat,dHexFloat
316
Bram Moolenaar071d4272004-06-13 20:20:40 +0000317syn case match
318
319" Pragma (preprocessor) support
320" TODO: Highlight following Integer and optional Filespec.
321syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$"
322
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100323" Block
324"
325syn region dBlock start="{" end="}" transparent fold
326
Bram Moolenaar071d4272004-06-13 20:20:40 +0000327
328" The default highlighting.
329"
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200330hi def link dBinary Number
331hi def link dDec Number
332hi def link dHex Number
333hi def link dOctal Number
334hi def link dFloat Float
335hi def link dHexFloat Float
336hi def link dDebug Debug
337hi def link dBranch Conditional
338hi def link dConditional Conditional
339hi def link dLabel Label
340hi def link dUserLabel Label
341hi def link dRepeat Repeat
342hi def link dExceptions Exception
343hi def link dAssert Statement
344hi def link dStatement Statement
345hi def link dScopeDecl dStorageClass
346hi def link dStorageClass StorageClass
347hi def link dBoolean Boolean
348hi def link dUnicode Special
349hi def link dTokenStringBrack String
350hi def link dHereString String
351hi def link dNestString String
352hi def link dDelimString String
353hi def link dRawString String
354hi def link dString String
355hi def link dHexString String
356hi def link dCharacter Character
357hi def link dEscSequence SpecialChar
358hi def link dSpecialCharError Error
359hi def link dOctalError Error
360hi def link dOperator Operator
361hi def link dOpOverload Identifier
362hi def link dConstant Constant
363hi def link dTypedef Typedef
364hi def link dEnum Structure
365hi def link dStructure Structure
366hi def link dTodo Todo
367hi def link dType Type
368hi def link dLineComment Comment
369hi def link dBlockComment Comment
370hi def link dNestedComment Comment
371hi def link dExternal Include
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200372hi def link dAnnotation PreProc
373hi def link dSharpBang PreProc
374hi def link dAttribute StorageClass
375hi def link dIdentifier Identifier
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200376hi def link dVersion dStatement
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100377hi def link dVersionIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100378hi def link dScopeIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100379hi def link dTraitsIdentifier Identifier
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200380hi def link dPragma PreProc
381hi def link dPragmaIdentifier Identifier
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100382hi def link dExtern dExternal
383hi def link dExternIdentifier Identifier
Bram Moolenaar9db9d9c2010-01-16 14:29:14 +0100384
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200385" Marks contents of the asm statment body as special
386
387syn match dAsmStatement "\<asm\>"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200388syn 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 +0200389
390hi def link dAsmBody dUnicode
391hi def link dAsmStatement dStatement
392hi def link dAsmOpCode Identifier
393
Bram Moolenaar543b7ef2013-06-01 14:50:56 +0200394syn keyword dAsmOpCode contained aaa aad aam aas
395syn keyword dAsmOpCode contained add addpd addps addsd
396syn keyword dAsmOpCode contained and andnpd andnps andpd
397syn keyword dAsmOpCode contained arpl bound bsf bsr
398syn keyword dAsmOpCode contained bt btc btr bts
399syn keyword dAsmOpCode contained call bswap andps addss
400syn keyword dAsmOpCode contained cbw cdq clc cld
401syn keyword dAsmOpCode contained cli clts cmc cmova
402syn keyword dAsmOpCode contained cmovb cmovbe cmovc cmove
403syn keyword dAsmOpCode contained cmovge cmovl cmovle cmovna
404syn keyword dAsmOpCode contained cmovnae cmovg cmovae clflush
405syn keyword dAsmOpCode contained cmovnb cmovnbe cmovnc cmovne
406syn keyword dAsmOpCode contained cmovnge cmovnl cmovnle cmovno
407syn keyword dAsmOpCode contained cmovns cmovnz cmovo cmovp
408syn keyword dAsmOpCode contained cmovpo cmovs cmovz cmp
409syn keyword dAsmOpCode contained cmppd cmovpe cmovnp cmovng
410syn keyword dAsmOpCode contained cmpps cmps cmpsb cmpsd
411syn keyword dAsmOpCode contained cmpsw cmpxch8b cmpxchg comisd
412syn keyword dAsmOpCode contained cpuid cvtdq2pd cvtdq2ps cvtpd2dq
413syn keyword dAsmOpCode contained cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq
414syn keyword dAsmOpCode contained cvtps2pd cvtpd2pi comiss cmpss
415syn keyword dAsmOpCode contained cvtps2pi cvtsd2si cvtsd2ss cvtsi2sd
416syn keyword dAsmOpCode contained cvtss2sd cvtss2si cvttpd2dq cvttpd2pi
417syn keyword dAsmOpCode contained cvttps2pi cvttsd2si cvttss2si cwd
418syn keyword dAsmOpCode contained da daa das db
419syn keyword dAsmOpCode contained dd cwde cvttps2dq cvtsi2ss
420syn keyword dAsmOpCode contained de dec df di
421syn keyword dAsmOpCode contained divpd divps divsd divss
422syn keyword dAsmOpCode contained dq ds dt dw
423syn keyword dAsmOpCode contained enter f2xm1 fabs fadd
424syn keyword dAsmOpCode contained faddp emms dl div
425syn keyword dAsmOpCode contained fbld fbstp fchs fclex
426syn keyword dAsmOpCode contained fcmovbe fcmove fcmovnb fcmovnbe
427syn keyword dAsmOpCode contained fcmovnu fcmovu fcom fcomi
428syn keyword dAsmOpCode contained fcomp fcompp fcos fdecstp
429syn keyword dAsmOpCode contained fdisi fcomip fcmovne fcmovb
430syn keyword dAsmOpCode contained fdiv fdivp fdivr fdivrp
431syn keyword dAsmOpCode contained ffree fiadd ficom ficomp
432syn keyword dAsmOpCode contained fidivr fild fimul fincstp
433syn keyword dAsmOpCode contained fist fistp fisub fisubr
434syn keyword dAsmOpCode contained fld finit fidiv feni
435syn keyword dAsmOpCode contained fld1 fldcw fldenv fldl2e
436syn keyword dAsmOpCode contained fldlg2 fldln2 fldpi fldz
437syn keyword dAsmOpCode contained fmulp fnclex fndisi fneni
438syn keyword dAsmOpCode contained fnop fnsave fnstcw fnstenv
439syn keyword dAsmOpCode contained fnstsw fninit fmul fldl2t
440syn keyword dAsmOpCode contained fpatan fprem fprem1 fptan
441syn keyword dAsmOpCode contained frstor fsave fscale fsetpm
442syn keyword dAsmOpCode contained fsincos fsqrt fst fstcw
443syn keyword dAsmOpCode contained fstp fstsw fsub fsubp
444syn keyword dAsmOpCode contained fsubr fstenv fsin frndint
445syn keyword dAsmOpCode contained fsubrp ftst fucom fucomi
446syn keyword dAsmOpCode contained fucomp fucompp fwait fxam
447syn keyword dAsmOpCode contained fxrstor fxsave fxtract fyl2x
448syn keyword dAsmOpCode contained hlt idiv imul in
449syn keyword dAsmOpCode contained inc fyl2xp1 fxch fucomip
450syn keyword dAsmOpCode contained ins insb insd insw
451syn keyword dAsmOpCode contained into invd invlpg iret
452syn keyword dAsmOpCode contained ja jae jb jbe
453syn keyword dAsmOpCode contained jcxz je jecxz jg
454syn keyword dAsmOpCode contained jge jc iretd int
455syn keyword dAsmOpCode contained jl jle jmp jna
456syn keyword dAsmOpCode contained jnb jnbe jnc jne
457syn keyword dAsmOpCode contained jnge jnl jnle jno
458syn keyword dAsmOpCode contained jns jnz jo jp
459syn keyword dAsmOpCode contained jpe jnp jng jnae
460syn keyword dAsmOpCode contained jpo js jz lahf
461syn keyword dAsmOpCode contained ldmxcsr lds lea leave
462syn keyword dAsmOpCode contained lfence lfs lgdt lgs
463syn keyword dAsmOpCode contained lldt lmsw lock lods
464syn keyword dAsmOpCode contained lodsb lidt les lar
465syn keyword dAsmOpCode contained lodsd lodsw loop loope
466syn keyword dAsmOpCode contained loopnz loopz lsl lss
467syn keyword dAsmOpCode contained maskmovdqu maskmovq maxpd maxps
468syn keyword dAsmOpCode contained maxss mfence minpd minps
469syn keyword dAsmOpCode contained minsd maxsd ltr loopne
470syn keyword dAsmOpCode contained minss mov movapd movaps
471syn keyword dAsmOpCode contained movdq2q movdqa movdqu movhlps
472syn keyword dAsmOpCode contained movhps movlhps movlpd movlps
473syn keyword dAsmOpCode contained movmskps movntdq movnti movntpd
474syn keyword dAsmOpCode contained movntps movmskpd movhpd movd
475syn keyword dAsmOpCode contained movntq movq movq2dq movs
476syn keyword dAsmOpCode contained movsd movss movsw movsx
477syn keyword dAsmOpCode contained movups movzx mul mulpd
478syn keyword dAsmOpCode contained mulsd mulss neg nop
479syn keyword dAsmOpCode contained not mulps movupd movsb
480syn keyword dAsmOpCode contained or orpd orps out
481syn keyword dAsmOpCode contained outsb outsd outsw packssdw
482syn keyword dAsmOpCode contained packuswb paddb paddd paddq
483syn keyword dAsmOpCode contained paddsw paddusb paddusw paddw
484syn keyword dAsmOpCode contained pand paddsb packsswb outs
485syn keyword dAsmOpCode contained pandn pavgb pavgw pcmpeqb
486syn keyword dAsmOpCode contained pcmpeqw pcmpgtb pcmpgtd pcmpgtw
487syn keyword dAsmOpCode contained pinsrw pmaddwd pmaxsw pmaxub
488syn keyword dAsmOpCode contained pminub pmovmskb pmulhuw pmulhw
489syn keyword dAsmOpCode contained pmullw pminsw pextrw pcmpeqd
490syn keyword dAsmOpCode contained pmuludq pop popa popad
491syn keyword dAsmOpCode contained popfd por prefetchnta prefetcht0
492syn keyword dAsmOpCode contained prefetcht2 psadbw pshufd pshufhw
493syn keyword dAsmOpCode contained pshufw pslld pslldq psllq
494syn keyword dAsmOpCode contained psllw pshuflw prefetcht1 popf
495syn keyword dAsmOpCode contained psrad psraw psrld psrldq
496syn keyword dAsmOpCode contained psrlw psubb psubd psubq
497syn keyword dAsmOpCode contained psubsw psubusb psubusw psubw
498syn keyword dAsmOpCode contained punpckhdq punpckhqdq punpckhwd punpcklbw
499syn keyword dAsmOpCode contained punpckldq punpckhbw psubsb psrlq
500syn keyword dAsmOpCode contained punpcklqdq punpcklwd push pusha
501syn keyword dAsmOpCode contained pushf pushfd pxor rcl
502syn keyword dAsmOpCode contained rcpss rcr rdmsr rdpmc
503syn keyword dAsmOpCode contained rep repe repne repnz
504syn keyword dAsmOpCode contained repz rdtsc rcpps pushad
505syn keyword dAsmOpCode contained ret retf rol ror
506syn keyword dAsmOpCode contained rsqrtps rsqrtss sahf sal
507syn keyword dAsmOpCode contained sbb scas scasb scasd
508syn keyword dAsmOpCode contained seta setae setb setbe
509syn keyword dAsmOpCode contained setc scasw sar rsm
510syn keyword dAsmOpCode contained sete setg setge setl
511syn keyword dAsmOpCode contained setna setnae setnb setnbe
512syn keyword dAsmOpCode contained setne setng setnge setnl
513syn keyword dAsmOpCode contained setno setnp setns setnz
514syn keyword dAsmOpCode contained seto setnle setnc setle
515syn keyword dAsmOpCode contained setp setpe setpo sets
516syn keyword dAsmOpCode contained sfence sgdt shl shld
517syn keyword dAsmOpCode contained shrd shufpd shufps sidt
518syn keyword dAsmOpCode contained smsw sqrtpd sqrtps sqrtsd
519syn keyword dAsmOpCode contained sqrtss sldt shr setz
520syn keyword dAsmOpCode contained stc std sti stmxcsr
521syn keyword dAsmOpCode contained stosb stosd stosw str
522syn keyword dAsmOpCode contained subpd subps subsd subss
523syn keyword dAsmOpCode contained sysexit test ucomisd ucomiss
524syn keyword dAsmOpCode contained ud2 sysenter sub stos
525syn keyword dAsmOpCode contained unpckhpd unpckhps unpcklpd unpcklps
526syn keyword dAsmOpCode contained verw wbinvd wrmsr xadd
527syn keyword dAsmOpCode contained xchg xlatb xor xorpd
528syn keyword dAsmOpCode contained xorps pfrcpit1 pfmin movddup
529syn keyword dAsmOpCode contained addsubpd addsubps fisttp haddps
530syn keyword dAsmOpCode contained hsubpd hsubps lddqu monitor
531syn keyword dAsmOpCode contained haddpd xlat wait verr
532syn keyword dAsmOpCode contained movshdup movsldup mwait pfcmpeq
533syn keyword dAsmOpCode contained pavgusb pf2id pfacc pfadd
534syn keyword dAsmOpCode contained pfcmpge pfcmpgt pfmax pfmul
535syn keyword dAsmOpCode contained pfnacc pfpnacc pfrcp pfrcpit1
536syn keyword dAsmOpCode contained pfrsqit1 pfrsqrt pfsub pfsubr
537syn keyword dAsmOpCode contained pmulhrw pswapd syscall sysret
538syn keyword dAsmOpCode contained vpmuldq xgetbv cmpxchg8b cmpxchg16b
539syn keyword dAsmOpCode contained pabsb pabsd pabsw palignr
540syn keyword dAsmOpCode contained phaddd phaddsw phaddw phsubd
541syn keyword dAsmOpCode contained phsubsw phsubw pmaddubsw pmulhrsw
542syn keyword dAsmOpCode contained pshufb psignb psignd psignw
543syn keyword dAsmOpCode contained popfq pushfq blendpd blendps
544syn keyword dAsmOpCode contained blendvpd blendvps extractps insertps
545syn keyword dAsmOpCode contained movntdqa mpsadbw packusdw pblendvb
546syn keyword dAsmOpCode contained pblendw pcmpeqq pextrb pextrd
547syn keyword dAsmOpCode contained pextrq phminposuw pinsrb pinsrd
548syn keyword dAsmOpCode contained pinsrq pmaxsb pmaxsd pmaxud
549syn keyword dAsmOpCode contained pmaxuw pminsb pminsd pminud
550syn keyword dAsmOpCode contained pminuw pmulld ptest roundpd
551syn keyword dAsmOpCode contained roundps roundsd roundss pmuldq
552syn keyword dAsmOpCode contained pmovsxbd pmovsxdq pmovzxbq pmovzxdq
553syn keyword dAsmOpCode contained pmovsxbq pmovsxwd pmovzxbq pmovzxwd
554syn keyword dAsmOpCode contained pmovsxbw pmovsxwq pmovzxbw pmovzxwq
555syn keyword dAsmOpCode contained crc32 pcmpestri pcmpestrm pcmpgtq
556syn keyword dAsmOpCode contained pcmpistri pcmpistrm popcnt pi2fd
557syn keyword dAsmOpCode contained adc
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +0200558
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100559let &cpo = s:cpo_save
560unlet s:cpo_save