comparison runtime/syntax/d.vim @ 739:6e8086ed3b4b

updated for version 7.0222
author vimboss
date Sun, 12 Mar 2006 21:53:56 +0000
parents 862863033fdd
children 8cd729851562
comparison
equal deleted inserted replaced
738:5c9e7c6e6e2e 739:6e8086ed3b4b
1 " Vim syntax file for the D programming language (version 0.137). 1 " Vim syntax file for the D programming language (version 0.149).
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 " Last Change: 2005 Oct 29 5 " When emailing me, please put the word vim somewhere in the subject
6 " Version: 0.14 6 " to ensure the email does not get marked as spam.
7 " 7 " Last Change: 2006 Mar 12
8 " Please email me with bugs, comments, and suggestion. Put vim in the subject 8 " Version: 0.15
9 " to ensure the email will not be marked has spam.
10 " 9 "
11 " Options: 10 " Options:
12 " d_comment_strings - set to highlight strings and numbers in comments 11 " d_comment_strings - set to highlight strings and numbers in comments
13 " 12 "
14 " d_hl_operator_overload - set to highlight D's specially named functions 13 " d_hl_operator_overload - set to highlight D's specially named functions
15 " that when overloaded implement unary and binary operators (e.g. cmp). 14 " that when overloaded implement unary and binary operators (e.g. cmp).
16 " 15 "
17 " Todo: 16 " Todo:
18 " - Allow user to set sync minlines 17 " - Must determine a better method of sync'ing than simply setting minlines
18 " to a large number for /+ +/.
19 " 19 "
20 " - Several keywords (namely, in and out) are both storage class and 20 " - Several keywords (namely, in and out) are both storage class and
21 " statements, depending on their context. Must use some matching to figure 21 " statements, depending on their context. Must use some matching to figure
22 " out which and highlight appropriately. For now I have made such keywords 22 " out which and highlight appropriately. For now I have made such keywords
23 " statements. 23 " statements.
24 " 24 "
25 " - Mark contents of the asm statement body as special 25 " - Mark contents of the asm statement body as special
26 "
27 " - Highlight the string prefix r and and postfixes c,w,d
28 " 26 "
29 27
30 " Quit when a syntax file was already loaded 28 " Quit when a syntax file was already loaded
31 if exists("b:current_syntax") 29 if exists("b:current_syntax")
32 finish 30 finish
51 syn keyword dOpOverload opShl opShl_r opShr opShr_r opUShr opUShr_r opCat 49 syn keyword dOpOverload opShl opShl_r opShr opShr_r opUShr opUShr_r opCat
52 syn keyword dOpOverload opCat_r opEquals opEquals opCmp opCmp opCmp opCmp 50 syn keyword dOpOverload opCat_r opEquals opEquals opCmp opCmp opCmp opCmp
53 syn keyword dOpOverload opAddAssign opSubAssign opMulAssign opDivAssign 51 syn keyword dOpOverload opAddAssign opSubAssign opMulAssign opDivAssign
54 syn keyword dOpOverload opModAssign opAndAssign opOrAssign opXorAssign 52 syn keyword dOpOverload opModAssign opAndAssign opOrAssign opXorAssign
55 syn keyword dOpOverload opShlAssign opShrAssign opUShrAssign opCatAssign 53 syn keyword dOpOverload opShlAssign opShrAssign opUShrAssign opCatAssign
56 syn keyword dOpOverload opIndex opIndexAssign opCall opSlice opPos 54 syn keyword dOpOverload opIndex opIndexAssign opCall opSlice opSliceAssign opPos
57 syn keyword dOpOverload opAdd_r opMul_r opAnd_r opOr_r opXor_r 55 syn keyword dOpOverload opAdd_r opMul_r opAnd_r opOr_r opXor_r
58 endif 56 endif
59 syn keyword dType ushort int uint long ulong float 57 syn keyword dType ushort int uint long ulong float
60 syn keyword dType void byte ubyte double bit char wchar ucent cent 58 syn keyword dType void byte ubyte double bit char wchar ucent cent
61 syn keyword dType short bool dchar 59 syn keyword dType short bool dchar
62 syn keyword dType real ireal ifloat idouble creal cfloat cdouble 60 syn keyword dType real ireal ifloat idouble creal cfloat cdouble
63 syn keyword dDebug deprecated unittest 61 syn keyword dDebug deprecated unittest
64 syn keyword dExceptions throw try catch finally 62 syn keyword dExceptions throw try catch finally
65 syn keyword dScopeDecl public protected private export 63 syn keyword dScopeDecl public protected private export
66 syn keyword dStatement version debug return with invariant body 64 syn keyword dStatement version debug return with invariant body scope
67 syn keyword dStatement in out inout asm mixin 65 syn keyword dStatement in out inout asm mixin
68 syn keyword dStatement function delegate 66 syn keyword dStatement function delegate
69 syn keyword dStorageClass auto static override final const abstract volatile 67 syn keyword dStorageClass auto static override final const abstract volatile
70 syn keyword dStorageClass synchronized 68 syn keyword dStorageClass synchronized
71 syn keyword dPragma pragma 69 syn keyword dPragma pragma
114 hi link dBlockCommentString dString 112 hi link dBlockCommentString dString
115 hi link dNestedCommentString dString 113 hi link dNestedCommentString dString
116 hi link dCommentStar dBlockComment 114 hi link dCommentStar dBlockComment
117 hi link dCommentPlus dNestedComment 115 hi link dCommentPlus dNestedComment
118 116
119 syn sync minlines=25 117 " /+ +/ style comments and strings that span multiple lines can cause
118 " problems. To play it safe, set minlines to a large number.
119 syn sync minlines=200
120 " Use ccomment for /* */ style comments
121 syn sync ccomment dBlockComment
120 122
121 " Characters 123 " Characters
122 " 124 "
123 syn match dSpecialCharError contained "[^']" 125 syn match dSpecialCharError contained "[^']"
124 126
133 " Unicode characters 135 " Unicode characters
134 " 136 "
135 syn match dUnicode "\\u\d\{4\}" 137 syn match dUnicode "\\u\d\{4\}"
136 138
137 139
138
139 " String. 140 " String.
140 " 141 "
141 syn region dString start=+"+ end=+"+ contains=dEscSequence,@Spell 142 syn region dString start=+"+ end=+"[cwd]\=+ contains=dEscSequence,@Spell
142 syn region dRawString start=+`+ skip=+\\`+ end=+`+ contains=@Spell 143 syn region dRawString start=+`+ skip=+\\`+ end=+`[cwd]\=+ contains=@Spell
143 "syn region dRawString start=+r"+ skip=+\\"+ end=+"+ contains=@Spell 144 syn region dRawString start=+r"+ skip=+\\"+ end=+"[cwd]\=+ contains=@Spell
144 syn region dHexString start=+x"+ skip=+\\"+ end=+"+ 145 syn region dHexString start=+x"+ skip=+\\"+ end=+"[cwd]\=+ contains=@Spell
145 146
146 " Numbers 147 " Numbers
147 " 148 "
148 syn case ignore 149 syn case ignore
149 syn match dInt display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>" 150
151 syn match dDec display "\<\d[0-9_]*\(u\=l\=\|l\=u\=\)\>"
152
150 " Hex number 153 " Hex number
151 syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>" 154 syn match dHex display "\<0x[0-9a-f_]\+\(u\=l\=\|l\=u\=\)\>"
152 syn match dHex display "\<\x[0-9a-f_]*h\(u\=l\=\|l\=u\=\)\>" 155
153 " Flag the first zero of an octal number as something special 156 syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>"
154 syn match dOctal display "\<0[0-7_]\+\(u\=l\=\|l\=u\=\)\>" contains=cOctalZero 157 " flag an octal number with wrong digits
155 syn match dOctalZero display contained "\<0" 158 syn match dOctalError display "\<0[0-7_]*[89][0-9_]*"
159
160 " binary numbers
161 syn match dBinary display "\<0b[01_]\+\(u\=l\=\|l\=u\=\)\>"
156 162
157 "floating point without the dot 163 "floating point without the dot
158 syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>" 164 syn match dFloat display "\<\d[0-9_]*\(fi\=\|l\=i\)\>"
159 "floating point number, with dot, optional exponent 165 "floating point number, with dot, optional exponent
160 syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\=" 166 syn match dFloat display "\<\d[0-9_]*\.[0-9_]*\(e[-+]\=[0-9_]\+\)\=[fl]\=i\="
163 "floating point number, without dot, with exponent 169 "floating point number, without dot, with exponent
164 "syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>" 170 "syn match dFloat display "\<\d\+e[-+]\=\d\+[fl]\=\>"
165 syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>" 171 syn match dFloat display "\<\d[0-9_]*e[-+]\=[0-9_]\+[fl]\=\>"
166 172
167 "floating point without the dot 173 "floating point without the dot
168 syn match dHexFloat display "\<0x\x\+\(fi\=\|l\=i\)\>" 174 syn match dHexFloat display "\<0x[0-9a-f_]\+\(fi\=\|l\=i\)\>"
169 "floating point number, with dot, optional exponent 175 "floating point number, with dot, optional exponent
170 syn match dHexFloat display "\<0x\x\+\.\x*\(p[-+]\=\x\+\)\=[fl]\=i\=" 176 syn match dHexFloat display "\<0x[0-9a-f_]\+\.[0-9a-f_]*\(p[-+]\=[0-9_]\+\)\=[fl]\=i\="
171 "floating point number, without dot, with exponent 177 "floating point number, without dot, with exponent
172 syn match dHexFloat display "\<0x\x\+p[-+]\=\x\+[fl]\=\>" 178 syn match dHexFloat display "\<0x[0-9a-f_]\+p[-+]\=[0-9_]\+[fl]\=i\=\>"
173 179
174 " binary numbers
175 syn match dBinary display "\<0b[01_]\+\>"
176 " flag an octal number with wrong digits
177 syn match dOctalError display "0\o*[89]\d*"
178 syn case match 180 syn case match
179 181
180 " Pragma (preprocessor) support 182 " Pragma (preprocessor) support
181 " TODO: Highlight following Integer and optional Filespec. 183 " TODO: Highlight following Integer and optional Filespec.
182 syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$" 184 syn region dPragma start="#\s*\(line\>\)" skip="\\$" end="$"
183 185
184 186
185 " The default highlighting. 187 " The default highlighting.
186 " 188 "
187 hi def link dBinary Number 189 hi def link dBinary Number
188 hi def link dInt Number 190 hi def link dDec Number
189 hi def link dHex Number 191 hi def link dHex Number
190 hi def link dOctal Number 192 hi def link dOctal Number
191 hi def link dFloat Float 193 hi def link dFloat Float
192 hi def link dHexFloat Float 194 hi def link dHexFloat Float
193 hi def link dDebug Debug 195 hi def link dDebug Debug
222 hi def link dNestedComment Comment 224 hi def link dNestedComment Comment
223 hi def link dExternal Include 225 hi def link dExternal Include
224 hi def link dPragma PreProc 226 hi def link dPragma PreProc
225 227
226 let b:current_syntax = "d" 228 let b:current_syntax = "d"
227 229
228 " vim: ts=8 noet 230 " vim: ts=8 noet