comparison runtime/syntax/d.vim @ 17:9be87deaeb52 v7.0009

updated for version 7.0009
author vimboss
date Fri, 16 Jul 2004 20:18:37 +0000
parents 3fc0f57ecb91
children 3b32f6b507fa
comparison
equal deleted inserted replaced
16:3ba373b54370 17:9be87deaeb52
1 " Vim syntax file for the D programming language (version 0.90). 1 " Vim syntax file for the D programming language (version 0.95).
2 " 2 "
3 " Language: D 3 " Language: D
4 " Maintainer: Jason Mills<jmills@cs.mun.ca> 4 " Maintainer: Jason Mills<jmills@cs.mun.ca>
5 " URL: 5 " Last Change: 2004 Jul 15
6 " Last Change: 2004 May 21 6 " Version: 0.10
7 " Version: 0.8
8 " 7 "
9 " Options: 8 " Options:
10 " d_comment_strings - set to highlight strings and numbers in comments 9 " d_comment_strings - set to highlight strings and numbers in comments
11 " 10 "
12 " d_hl_operator_overload - set to highlight D's specially named functions 11 " d_hl_operator_overload - set to highlight D's specially named functions
28 finish 27 finish
29 endif 28 endif
30 29
31 " Keyword definitions 30 " Keyword definitions
32 " 31 "
33 syn keyword dExternal import module extern 32 syn keyword dExternal import package module extern
34 syn keyword dConditional if else switch 33 syn keyword dConditional if else switch
35 syn keyword dBranch goto break continue 34 syn keyword dBranch goto break continue
36 syn keyword dRepeat while for do foreach 35 syn keyword dRepeat while for do foreach
37 syn keyword dBoolean true false 36 syn keyword dBoolean true false
38 syn keyword dConstant null 37 syn keyword dConstant null
39 syn keyword dTypedef alias typedef 38 syn keyword dTypedef alias typedef
40 syn keyword dStructure template interface class enum struct union 39 syn keyword dStructure template interface class enum struct union
41 syn keyword dOperator new delete typeof cast align is 40 syn keyword dOperator new delete typeof typeid cast align is
42 syn keyword dOperator this super 41 syn keyword dOperator this super
43 if exists("d_hl_operator_overload") 42 if exists("d_hl_operator_overload")
44 syn keyword dOpOverload opNeg opCom opPostInc opPostDec opAdd opSub opSub_r 43 syn keyword dOpOverload opNeg opCom opPostInc opPostDec opAdd opSub opSub_r
45 syn keyword dOpOverload opMul opDiv opDiv_r opMod opMod_r opAnd opOr opXor 44 syn keyword dOpOverload opMul opDiv opDiv_r opMod opMod_r opAnd opOr opXor
46 syn keyword dOpOverload opShl opShl_r opShr opShr_r opUShr opUShr_r opCat 45 syn keyword dOpOverload opShl opShl_r opShr opShr_r opUShr opUShr_r opCat
47 syn keyword dOpOverload opCat_r opEquals opEquals opCmp opCmp opCmp opCmp 46 syn keyword dOpOverload opCat_r opEquals opEquals opCmp opCmp opCmp opCmp
48 syn keyword dOpOverload opAddAssign opSubAssign opMulAssign opDivAssign 47 syn keyword dOpOverload opAddAssign opSubAssign opMulAssign opDivAssign
49 syn keyword dOpOverload opModAssign opAndAssign opOrAssign opXorAssign 48 syn keyword dOpOverload opModAssign opAndAssign opOrAssign opXorAssign
50 syn keyword dOpOverload opShlAssign opShrAssign opUShrAssign opCatAssign 49 syn keyword dOpOverload opShlAssign opShrAssign opUShrAssign opCatAssign
51 syn keyword dOpOverload opIndex opCall opSlice 50 syn keyword dOpOverload opIndex opIndexAssign opCall opSlice
51 syn keyword dOpOverload opAdd_r opMul_r opAnd_r opOr_r opXor_r
52 endif 52 endif
53 syn keyword dType ushort int uint long ulong float 53 syn keyword dType ushort int uint long ulong float
54 syn keyword dType void byte ubyte double bit char wchar ucent cent 54 syn keyword dType void byte ubyte double bit char wchar ucent cent
55 syn keyword dType short bool dchar 55 syn keyword dType short bool dchar
56 syn keyword dType real ireal ifloat idouble creal cfloat cdouble 56 syn keyword dType real ireal ifloat idouble creal cfloat cdouble
57 syn keyword dDebug deprecated unittest 57 syn keyword dDebug deprecated unittest
58 syn keyword dExceptions throw try catch finally 58 syn keyword dExceptions throw try catch finally
59 syn keyword dScopeDecl public protected private export 59 syn keyword dScopeDecl public protected private export
60 syn keyword dStatement version debug return with invariant body 60 syn keyword dStatement version debug return with invariant body
61 syn keyword dStatement in out inout asm mixin 61 syn keyword dStatement in out inout asm mixin
62 syn keyword dStatement function delegate 62 syn keyword dStatement function delegate
63 syn keyword dStorageClass auto static override final const abstract volatile 63 syn keyword dStorageClass auto static override final const abstract volatile
64 syn keyword dStorageClass synchronized 64 syn keyword dStorageClass synchronized
65 syn keyword dPragma pragma 65 syn keyword dPragma pragma
66 66
67 67
68 " Assert is a statement and a module name. 68 " Assert is a statement and a module name.
69 syn match dAssert "^assert\>" 69 syn match dAssert "^assert\>"
70 syn match dAssert "[^.]\s*\<assert\>"ms=s+1 70 syn match dAssert "[^.]\s*\<assert\>"ms=s+1
79 "hi def link dAsmStatement dStatement 79 "hi def link dAsmStatement dStatement
80 80
81 " Labels 81 " Labels
82 " 82 "
83 " We contain dScopeDecl so public: private: etc. are not highlighted like labels 83 " We contain dScopeDecl so public: private: etc. are not highlighted like labels
84 syn match dUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=dLabel,dScopeDecl 84 syn match dUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=dLabel,dScopeDecl
85 syn keyword dLabel case default 85 syn keyword dLabel case default
86 86
87 " Comments 87 " Comments
88 " 88 "
89 syn keyword dTodo contained TODO FIXME TEMP XXX 89 syn keyword dTodo contained TODO FIXME TEMP XXX
90 syn match dCommentStar contained "^\s*\*[^/]"me=e-1 90 syn match dCommentStar contained "^\s*\*[^/]"me=e-1
91 syn match dCommentStar contained "^\s*\*$" 91 syn match dCommentStar contained "^\s*\*$"
92 syn match dCommentPlus contained "^\s*+[^/]"me=e-1 92 syn match dCommentPlus contained "^\s*+[^/]"me=e-1
93 syn match dCommentPlus contained "^\s*+$" 93 syn match dCommentPlus contained "^\s*+$"
94 if exists("d_comment_strings") 94 if exists("d_comment_strings")
95 syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell 95 syn region dBlockCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@Spell
96 syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell 96 syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@Spell
97 syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell 97 syn region dLineCommentString contained start=+"+ end=+$\|"+ contains=dUnicode,dEscSequence,@Spell
98 syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell 98 syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell
99 syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell 99 syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell
100 syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell 100 syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
101 else 101 else
102 syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell 102 syn region dBlockComment start="/\*" end="\*/" contains=dBlockCommentString,dTodo,@Spell
103 syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell 103 syn region dNestedComment start="/+" end="+/" contains=dNestedComment,dNestedCommentString,dTodo,@Spell
104 syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell 104 syn match dLineComment "//.*" contains=dLineCommentString,dTodo,@Spell
105 endif 105 endif
106 106
107 hi link dLineCommentString dBlockCommentString 107 hi link dLineCommentString dBlockCommentString
108 hi link dBlockCommentString dString 108 hi link dBlockCommentString dString
109 hi link dNestedCommentString dString 109 hi link dNestedCommentString dString
110 hi link dCommentStar dBlockComment 110 hi link dCommentStar dBlockComment
111 hi link dCommentPlus dNestedComment 111 hi link dCommentPlus dNestedComment
112 112
113 syn sync minlines=25 113 syn sync minlines=25
114 114
115 " Characters 115 " Characters
116 " 116 "
117 syn match dSpecialCharError contained "[^']" 117 syn match dSpecialCharError contained "[^']"
118 118
119 " Escape sequences (oct,specal char,hex,wchar). These are not contained 119 " Escape sequences (oct,specal char,hex,wchar). These are not contained
120 " because they are considered string litterals 120 " because they are considered string litterals
121 syn match dEscSequence "\\\(\o\{1,3}\|[\"\\'\\?ntbrfva]\|u\x\{4}\|U\x\{8}\|x\x\x\)" 121 syn match dEscSequence "\\\(\o\{1,3}\|[\"\\'\\?ntbrfva]\|u\x\{4}\|U\x\{8}\|x\x\x\)"
122 syn match dCharacter "'[^']*'" contains=dEscSequence,dSpecialCharError 122 syn match dCharacter "'[^']*'" contains=dEscSequence,dSpecialCharError
123 syn match dCharacter "'\\''" contains=dEscSequence 123 syn match dCharacter "'\\''" contains=dEscSequence
124 syn match dCharacter "'[^\\]'" 124 syn match dCharacter "'[^\\]'"
125 125
126 " Unicode characters 126 " Unicode characters
127 " 127 "
128 syn match dUnicode "\\u\d\{4\}" 128 syn match dUnicode "\\u\d\{4\}"
129 129
130 " String. 130 " String.
131 " 131 "
132 syn region dString start=+"+ end=+"+ contains=dEscSequence,@Spell 132 syn region dString start=+"+ end=+"+ contains=dEscSequence,@Spell
133 syn region dRawString start=+`+ skip=+\\`+ end=+`+ contains=@Spell 133 syn region dRawString start=+`+ skip=+\\`+ end=+`+ contains=@Spell
134 syn region dRawString start=+r"+ skip=+\\"+ end=+"+ contains=@Spell 134 syn region dRawString start=+r"+ skip=+\\"+ end=+"+ contains=@Spell
135 syn region dHexString start=+x"+ skip=+\\"+ end=+"+ 135 syn region dHexString start=+x"+ skip=+\\"+ end=+"+
136 136
137 " Numbers 137 " Numbers
138 " 138 "
139 syn case ignore 139 syn case ignore
140 syn match dInt display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>" 140 syn match dInt display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>"
141 " Hex number 141 " Hex number
142 syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>" 142 syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>"
143 syn match dHex display "\<\x[0-9a-f_]*h\(u\=l\=\|l\=u\=\)\>" 143 syn match dHex display "\<\x[0-9a-f_]*h\(u\=l\=\|l\=u\=\)\>"
144 " Flag the first zero of an octal number as something special 144 " Flag the first zero of an octal number as something special
145 syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>" contains=cOctalZero 145 syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>" contains=cOctalZero
146 syn match dOctalZero display contained "\<0" 146 syn match dOctalZero display contained "\<0"
147 147
148 "floating point without the dot 148 "floating point without the dot
149 syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>" 149 syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>"
150 "floating point number, with dot, optional exponent 150 "floating point number, with dot, optional exponent
151 syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=" 151 syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\="
152 "floating point number, starting with a dot, optional exponent 152 "floating point number, starting with a dot, optional exponent
153 syn match dFloat display "\(\.[0-9_]\+\)\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=\>" 153 syn match dFloat display "\(\.[0-9_]\+\)\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=\>"
154 "floating point number, without dot, with exponent 154 "floating point number, without dot, with exponent
155 "syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>" 155 "syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>"
156 syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>" 156 syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>"
157 157
158 "floating point without the dot 158 "floating point without the dot
159 syn match dHexFloat display "\<0x\x\+\(fi\=\|l\=i\)\>" 159 syn match dHexFloat display "\<0x\x\+\(fi\=\|l\=i\)\>"
160 "floating point number, with dot, optional exponent 160 "floating point number, with dot, optional exponent
161 syn match dHexFloat display "\<0x\x\+\.\x*\(p[-+]\=\x\+\)\=[fl]\=i\=" 161 syn match dHexFloat display "\<0x\x\+\.\x*\(p[-+]\=\x\+\)\=[fl]\=i\="
162 "floating point number, without dot, with exponent 162 "floating point number, without dot, with exponent
163 syn match dHexFloat display "\<0x\x\+p[-+]\=\x\+[fl]\=\>" 163 syn match dHexFloat display "\<0x\x\+p[-+]\=\x\+[fl]\=\>"
164 164
165 " binary numbers 165 " binary numbers
166 syn match dBinary display "\<0b[01_]\+\>" 166 syn match dBinary display "\<0b[01_]\+\>"
167 " flag an octal number with wrong digits 167 " flag an octal number with wrong digits
168 syn match dOctalError display "0\o*[89]\d*" 168 syn match dOctalError display "0\o*[89]\d*"
169 syn case match 169 syn case match
170 170
171 " Pragma (preprocessor) support 171 " Pragma (preprocessor) support
172 " TODO: Highlight following Integer and optional Filespec. 172 " TODO: Highlight following Integer and optional Filespec.
173 syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$" 173 syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$"