7
|
1 " Vim syntax file
|
|
2 " Language: C#
|
|
3 " Maintainer: Johannes Zellner <johannes@zellner.org>
|
236
|
4 " Last Change: Mi, 13 Apr 2005 22:52:57 CEST
|
7
|
5 " Filenames: *.cs
|
|
6 " $Id$
|
|
7 "
|
|
8 " REFERENCES:
|
|
9 " [1] ECMA TC39: C# Language Specification (WD13Oct01.doc)
|
|
10
|
|
11 if exists("b:current_syntax")
|
|
12 finish
|
|
13 endif
|
|
14
|
|
15 let s:cs_cpo_save = &cpo
|
|
16 set cpo&vim
|
|
17
|
|
18
|
|
19 " type
|
|
20 syn keyword csType bool byte char decimal double float int long object sbyte short string uint ulong ushort void
|
|
21 " storage
|
|
22 syn keyword csStorage class delegate enum interface namespace struct
|
|
23 " repeate / condition / label
|
|
24 syn keyword csRepeat break continue do for foreach goto return while
|
|
25 syn keyword csConditional else if switch
|
|
26 syn keyword csLabel case default
|
|
27 " there's no :: operator in C#
|
|
28 syn match csOperatorError display +::+
|
|
29 " user labels (see [1] 8.6 Statements)
|
|
30 syn match csLabel display +^\s*\I\i*\s*:\([^:]\)\@=+
|
|
31 " modifier
|
|
32 syn keyword csModifier abstract const extern internal override private protected public readonly sealed static virtual volatile
|
|
33 " constant
|
|
34 syn keyword csConstant false null true
|
|
35 " exception
|
|
36 syn keyword csException try catch finally throw
|
|
37
|
|
38 " TODO:
|
|
39 syn keyword csUnspecifiedStatement as base checked event fixed in is lock new operator out params ref sizeof stackalloc this typeof unchecked unsafe using
|
|
40 " TODO:
|
|
41 syn keyword csUnsupportedStatement get set add remove value
|
|
42 " TODO:
|
|
43 syn keyword csUnspecifiedKeyword explicit implicit
|
|
44
|
|
45
|
|
46
|
|
47 " Comments
|
|
48 "
|
|
49 " PROVIDES: @csCommentHook
|
|
50 "
|
|
51 " TODO: include strings ?
|
|
52 "
|
|
53 syn keyword csTodo contained TODO FIXME XXX NOTE
|
|
54 syn region csComment start="/\*" end="\*/" contains=@csCommentHook,csTodo
|
|
55 syn match csComment "//.*$" contains=@csCommentHook,csTodo
|
|
56
|
|
57 " xml markup inside '///' comments
|
|
58 syn cluster xmlRegionHook add=csXmlCommentLeader
|
|
59 syn cluster xmlCdataHook add=csXmlCommentLeader
|
|
60 syn cluster xmlStartTagHook add=csXmlCommentLeader
|
|
61 syn keyword csXmlTag contained Libraries Packages Types Excluded ExcludedTypeName ExcludedLibraryName
|
|
62 syn keyword csXmlTag contained ExcludedBucketName TypeExcluded Type TypeKind TypeSignature AssemblyInfo
|
|
63 syn keyword csXmlTag contained AssemblyName AssemblyPublicKey AssemblyVersion AssemblyCulture Base
|
|
64 syn keyword csXmlTag contained BaseTypeName Interfaces Interface InterfaceName Attributes Attribute
|
|
65 syn keyword csXmlTag contained AttributeName Members Member MemberSignature MemberType MemberValue
|
|
66 syn keyword csXmlTag contained ReturnValue ReturnType Parameters Parameter MemberOfPackage
|
|
67 syn keyword csXmlTag contained ThreadingSafetyStatement Docs devdoc example overload remarks returns summary
|
|
68 syn keyword csXmlTag contained threadsafe value internalonly nodoc exception param permission platnote
|
|
69 syn keyword csXmlTag contained seealso b c i pre sub sup block code note paramref see subscript superscript
|
|
70 syn keyword csXmlTag contained list listheader item term description altcompliant altmember
|
|
71
|
|
72 syn cluster xmlTagHook add=csXmlTag
|
|
73
|
|
74 syn match csXmlCommentLeader +\/\/\/+ contained
|
|
75 syn match csXmlComment +\/\/\/.*$+ contains=csXmlCommentLeader,@csXml
|
|
76 syntax include @csXml <sfile>:p:h/xml.vim
|
|
77 hi def link xmlRegion Comment
|
|
78
|
|
79
|
|
80 " [1] 9.5 Pre-processing directives
|
|
81 syn region csPreCondit
|
|
82 \ start="^\s*#\s*\(define\|undef\|if\|elif\|else\|endif\|line\|error\|warning\|region\|endregion\)"
|
|
83 \ skip="\\$" end="$" contains=csComment keepend
|
|
84
|
|
85
|
|
86
|
|
87 " Strings and constants
|
|
88 syn match csSpecialError contained "\\."
|
|
89 syn match csSpecialCharError contained "[^']"
|
|
90 " [1] 9.4.4.4 Character literals
|
|
91 syn match csSpecialChar contained +\\["\\'0abfnrtvx]+
|
|
92 " unicode characters
|
|
93 syn match csUnicodeNumber +\\\(u\x\{4}\|U\x\{8}\)+ contained contains=csUnicodeSpecifier
|
|
94 syn match csUnicodeSpecifier +\\[uU]+ contained
|
236
|
95 syn region csVerbatimString start=+@"+ end=+"+ end=+$+ skip=+""+ contains=csVerbatimSpec
|
7
|
96 syn match csVerbatimSpec +@"+he=s+1 contained
|
|
97 syn region csString start=+"+ end=+"+ end=+$+ contains=csSpecialChar,csSpecialError,csUnicodeNumber
|
|
98 syn match csCharacter "'[^']*'" contains=csSpecialChar,csSpecialCharError
|
|
99 syn match csCharacter "'\\''" contains=csSpecialChar
|
|
100 syn match csCharacter "'[^\\]'"
|
|
101 syn match csNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
|
|
102 syn match csNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
|
|
103 syn match csNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
|
104 syn match csNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
|
|
105
|
|
106 " The default highlighting.
|
|
107 hi def link csType Type
|
|
108 hi def link csStorage StorageClass
|
|
109 hi def link csRepeat Repeat
|
|
110 hi def link csConditional Conditional
|
|
111 hi def link csLabel Label
|
|
112 hi def link csModifier StorageClass
|
|
113 hi def link csConstant Constant
|
|
114 hi def link csException Exception
|
|
115 hi def link csUnspecifiedStatement Statement
|
|
116 hi def link csUnsupportedStatement Statement
|
|
117 hi def link csUnspecifiedKeyword Keyword
|
|
118 hi def link csOperatorError Error
|
|
119
|
|
120 hi def link csTodo Todo
|
|
121 hi def link csComment Comment
|
|
122
|
|
123 hi def link csSpecialError Error
|
|
124 hi def link csSpecialCharError Error
|
|
125 hi def link csString String
|
|
126 hi def link csVerbatimString String
|
|
127 hi def link csVerbatimSpec SpecialChar
|
|
128 hi def link csPreCondit PreCondit
|
|
129 hi def link csCharacter Character
|
|
130 hi def link csSpecialChar SpecialChar
|
|
131 hi def link csNumber Number
|
|
132 hi def link csUnicodeNumber SpecialChar
|
|
133 hi def link csUnicodeSpecifier SpecialChar
|
|
134
|
|
135 " xml markup
|
|
136 hi def link csXmlCommentLeader Comment
|
|
137 hi def link csXmlComment Comment
|
|
138 hi def link csXmlTag Statement
|
|
139
|
|
140 let b:current_syntax = "cs"
|
|
141
|
|
142 let &cpo = s:cs_cpo_save
|
|
143 unlet s:cs_cpo_save
|
|
144
|
|
145 " vim: ts=8
|