7
|
1 " Vim syntax file
|
|
2 " Language: M$ Resource files (*.rc)
|
|
3 " Maintainer: Heiko Erhardt <Heiko.Erhardt@munich.netsurf.de>
|
|
4 " Last Change: 2001 May 09
|
|
5
|
|
6 " This file is based on the c.vim
|
|
7
|
|
8 " For version 5.x: Clear all syntax items
|
|
9 " For version 6.x: Quit when a syntax file was already loaded
|
|
10 if version < 600
|
|
11 syntax clear
|
|
12 elseif exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15
|
|
16 " Common RC keywords
|
|
17 syn keyword rcLanguage LANGUAGE
|
|
18
|
|
19 syn keyword rcMainObject TEXTINCLUDE VERSIONINFO BITMAP ICON CURSOR CURSOR
|
|
20 syn keyword rcMainObject MENU ACCELERATORS TOOLBAR DIALOG
|
|
21 syn keyword rcMainObject STRINGTABLE MESSAGETABLE RCDATA DLGINIT DESIGNINFO
|
|
22
|
|
23 syn keyword rcSubObject POPUP MENUITEM SEPARATOR
|
|
24 syn keyword rcSubObject CONTROL LTEXT CTEXT EDITTEXT
|
|
25 syn keyword rcSubObject BUTTON PUSHBUTTON DEFPUSHBUTTON GROUPBOX LISTBOX COMBOBOX
|
|
26 syn keyword rcSubObject FILEVERSION PRODUCTVERSION FILEFLAGSMASK FILEFLAGS FILEOS
|
|
27 syn keyword rcSubObject FILETYPE FILESUBTYPE
|
|
28
|
|
29 syn keyword rcCaptionParam CAPTION
|
|
30 syn keyword rcParam CHARACTERISTICS CLASS STYLE EXSTYLE VERSION FONT
|
|
31
|
|
32 syn keyword rcStatement BEGIN END BLOCK VALUE
|
|
33
|
|
34 syn keyword rcCommonAttribute PRELOAD LOADONCALL FIXED MOVEABLE DISCARDABLE PURE IMPURE
|
|
35
|
|
36 syn keyword rcAttribute WS_OVERLAPPED WS_POPUP WS_CHILD WS_MINIMIZE WS_VISIBLE WS_DISABLED WS_CLIPSIBLINGS
|
|
37 syn keyword rcAttribute WS_CLIPCHILDREN WS_MAXIMIZE WS_CAPTION WS_BORDER WS_DLGFRAME WS_VSCROLL WS_HSCROLL
|
|
38 syn keyword rcAttribute WS_SYSMENU WS_THICKFRAME WS_GROUP WS_TABSTOP WS_MINIMIZEBOX WS_MAXIMIZEBOX WS_TILED
|
|
39 syn keyword rcAttribute WS_ICONIC WS_SIZEBOX WS_TILEDWINDOW WS_OVERLAPPEDWINDOW WS_POPUPWINDOW WS_CHILDWINDOW
|
|
40 syn keyword rcAttribute WS_EX_DLGMODALFRAME WS_EX_NOPARENTNOTIFY WS_EX_TOPMOST WS_EX_ACCEPTFILES
|
|
41 syn keyword rcAttribute WS_EX_TRANSPARENT WS_EX_MDICHILD WS_EX_TOOLWINDOW WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE
|
|
42 syn keyword rcAttribute WS_EX_CONTEXTHELP WS_EX_RIGHT WS_EX_LEFT WS_EX_RTLREADING WS_EX_LTRREADING
|
|
43 syn keyword rcAttribute WS_EX_LEFTSCROLLBAR WS_EX_RIGHTSCROLLBAR WS_EX_CONTROLPARENT WS_EX_STATICEDGE
|
|
44 syn keyword rcAttribute WS_EX_APPWINDOW WS_EX_OVERLAPPEDWINDOW WS_EX_PALETTEWINDOW
|
|
45 syn keyword rcAttribute ES_LEFT ES_CENTER ES_RIGHT ES_MULTILINE ES_UPPERCASE ES_LOWERCASE ES_PASSWORD
|
|
46 syn keyword rcAttribute ES_AUTOVSCROLL ES_AUTOHSCROLL ES_NOHIDESEL ES_OEMCONVERT ES_READONLY ES_WANTRETURN
|
|
47 syn keyword rcAttribute ES_NUMBER
|
|
48 syn keyword rcAttribute BS_PUSHBUTTON BS_DEFPUSHBUTTON BS_CHECKBOX BS_AUTOCHECKBOX BS_RADIOBUTTON BS_3STATE
|
|
49 syn keyword rcAttribute BS_AUTO3STATE BS_GROUPBOX BS_USERBUTTON BS_AUTORADIOBUTTON BS_OWNERDRAW BS_LEFTTEXT
|
|
50 syn keyword rcAttribute BS_TEXT BS_ICON BS_BITMAP BS_LEFT BS_RIGHT BS_CENTER BS_TOP BS_BOTTOM BS_VCENTER
|
|
51 syn keyword rcAttribute BS_PUSHLIKE BS_MULTILINE BS_NOTIFY BS_FLAT BS_RIGHTBUTTON
|
|
52 syn keyword rcAttribute SS_LEFT SS_CENTER SS_RIGHT SS_ICON SS_BLACKRECT SS_GRAYRECT SS_WHITERECT
|
|
53 syn keyword rcAttribute SS_BLACKFRAME SS_GRAYFRAME SS_WHITEFRAME SS_USERITEM SS_SIMPLE SS_LEFTNOWORDWRAP
|
|
54 syn keyword rcAttribute SS_OWNERDRAW SS_BITMAP SS_ENHMETAFILE SS_ETCHEDHORZ SS_ETCHEDVERT SS_ETCHEDFRAME
|
|
55 syn keyword rcAttribute SS_TYPEMASK SS_NOPREFIX SS_NOTIFY SS_CENTERIMAGE SS_RIGHTJUST SS_REALSIZEIMAGE
|
|
56 syn keyword rcAttribute SS_SUNKEN SS_ENDELLIPSIS SS_PATHELLIPSIS SS_WORDELLIPSIS SS_ELLIPSISMASK
|
|
57 syn keyword rcAttribute DS_ABSALIGN DS_SYSMODAL DS_LOCALEDIT DS_SETFONT DS_MODALFRAME DS_NOIDLEMSG
|
|
58 syn keyword rcAttribute DS_SETFOREGROUND DS_3DLOOK DS_FIXEDSYS DS_NOFAILCREATE DS_CONTROL DS_CENTER
|
|
59 syn keyword rcAttribute DS_CENTERMOUSE DS_CONTEXTHELP
|
|
60 syn keyword rcAttribute LBS_NOTIFY LBS_SORT LBS_NOREDRAW LBS_MULTIPLESEL LBS_OWNERDRAWFIXED
|
|
61 syn keyword rcAttribute LBS_OWNERDRAWVARIABLE LBS_HASSTRINGS LBS_USETABSTOPS LBS_NOINTEGRALHEIGHT
|
|
62 syn keyword rcAttribute LBS_MULTICOLUMN LBS_WANTKEYBOARDINPUT LBS_EXTENDEDSEL LBS_DISABLENOSCROLL
|
|
63 syn keyword rcAttribute LBS_NODATA LBS_NOSEL LBS_STANDARD
|
|
64 syn keyword rcAttribute CBS_SIMPLE CBS_DROPDOWN CBS_DROPDOWNLIST CBS_OWNERDRAWFIXED CBS_OWNERDRAWVARIABLE
|
|
65 syn keyword rcAttribute CBS_AUTOHSCROLL CBS_OEMCONVERT CBS_SORT CBS_HASSTRINGS CBS_NOINTEGRALHEIGHT
|
|
66 syn keyword rcAttribute CBS_DISABLENOSCROLL CBS_UPPERCASE CBS_LOWERCASE
|
|
67 syn keyword rcAttribute SBS_HORZ SBS_VERT SBS_TOPALIGN SBS_LEFTALIGN SBS_BOTTOMALIGN SBS_RIGHTALIGN
|
|
68 syn keyword rcAttribute SBS_SIZEBOXTOPLEFTALIGN SBS_SIZEBOXBOTTOMRIGHTALIGN SBS_SIZEBOX SBS_SIZEGRIP
|
|
69 syn keyword rcAttribute CCS_TOP CCS_NOMOVEY CCS_BOTTOM CCS_NORESIZE CCS_NOPARENTALIGN CCS_ADJUSTABLE
|
|
70 syn keyword rcAttribute CCS_NODIVIDER
|
|
71 syn keyword rcAttribute LVS_ICON LVS_REPORT LVS_SMALLICON LVS_LIST LVS_TYPEMASK LVS_SINGLESEL LVS_SHOWSELALWAYS
|
|
72 syn keyword rcAttribute LVS_SORTASCENDING LVS_SORTDESCENDING LVS_SHAREIMAGELISTS LVS_NOLABELWRAP
|
|
73 syn keyword rcAttribute LVS_EDITLABELS LVS_OWNERDATA LVS_NOSCROLL LVS_TYPESTYLEMASK LVS_ALIGNTOP LVS_ALIGNLEFT
|
|
74 syn keyword rcAttribute LVS_ALIGNMASK LVS_OWNERDRAWFIXED LVS_NOCOLUMNHEADER LVS_NOSORTHEADER LVS_AUTOARRANGE
|
|
75 syn keyword rcAttribute TVS_HASBUTTONS TVS_HASLINES TVS_LINESATROOT TVS_EDITLABELS TVS_DISABLEDRAGDROP
|
|
76 syn keyword rcAttribute TVS_SHOWSELALWAYS
|
|
77 syn keyword rcAttribute TCS_FORCEICONLEFT TCS_FORCELABELLEFT TCS_TABS TCS_BUTTONS TCS_SINGLELINE TCS_MULTILINE
|
|
78 syn keyword rcAttribute TCS_RIGHTJUSTIFY TCS_FIXEDWIDTH TCS_RAGGEDRIGHT TCS_FOCUSONBUTTONDOWN
|
|
79 syn keyword rcAttribute TCS_OWNERDRAWFIXED TCS_TOOLTIPS TCS_FOCUSNEVER
|
|
80 syn keyword rcAttribute ACS_CENTER ACS_TRANSPARENT ACS_AUTOPLAY
|
|
81 syn keyword rcStdId IDI_APPLICATION IDI_HAND IDI_QUESTION IDI_EXCLAMATION IDI_ASTERISK IDI_WINLOGO IDI_WINLOGO
|
|
82 syn keyword rcStdId IDI_WARNING IDI_ERROR IDI_INFORMATION
|
|
83 syn keyword rcStdId IDCANCEL IDABORT IDRETRY IDIGNORE IDYES IDNO IDCLOSE IDHELP IDC_STATIC
|
|
84
|
|
85 " Common RC keywords
|
|
86
|
|
87 " Common RC keywords
|
|
88 syn keyword rcTodo contained TODO FIXME XXX
|
|
89
|
|
90 " String and Character constants
|
|
91 " Highlight special characters (those which have a backslash) differently
|
|
92 syn match rcSpecial contained "\\[0-7][0-7][0-7]\=\|\\."
|
|
93 syn region rcString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rcSpecial
|
|
94 syn match rcCharacter "'[^\\]'"
|
|
95 syn match rcSpecialCharacter "'\\.'"
|
|
96 syn match rcSpecialCharacter "'\\[0-7][0-7]'"
|
|
97 syn match rcSpecialCharacter "'\\[0-7][0-7][0-7]'"
|
|
98
|
|
99 "catch errors caused by wrong parenthesis
|
|
100 syn region rcParen transparent start='(' end=')' contains=ALLBUT,rcParenError,rcIncluded,rcSpecial,rcTodo
|
|
101 syn match rcParenError ")"
|
|
102 syn match rcInParen contained "[{}]"
|
|
103
|
|
104 "integer number, or floating point number without a dot and with "f".
|
|
105 syn case ignore
|
|
106 syn match rcNumber "\<\d\+\(u\=l\=\|lu\|f\)\>"
|
|
107 "floating point number, with dot, optional exponent
|
|
108 syn match rcFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
|
|
109 "floating point number, starting with a dot, optional exponent
|
|
110 syn match rcFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
|
|
111 "floating point number, without dot, with exponent
|
|
112 syn match rcFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"
|
|
113 "hex number
|
|
114 syn match rcNumber "\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>"
|
|
115 "syn match rcIdentifier "\<[a-z_][a-z0-9_]*\>"
|
|
116 syn case match
|
|
117 " flag an octal number with wrong digits
|
|
118 syn match rcOctalError "\<0[0-7]*[89]"
|
|
119
|
|
120 if exists("rc_comment_strings")
|
|
121 " A comment can contain rcString, rcCharacter and rcNumber.
|
|
122 " But a "*/" inside a rcString in a rcComment DOES end the comment! So we
|
|
123 " need to use a special type of rcString: rcCommentString, which also ends on
|
|
124 " "*/", and sees a "*" at the start of the line as comment again.
|
|
125 " Unfortunately this doesn't very well work for // type of comments :-(
|
|
126 syntax match rcCommentSkip contained "^\s*\*\($\|\s\+\)"
|
|
127 syntax region rcCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=rcSpecial,rcCommentSkip
|
|
128 syntax region rcComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=rcSpecial
|
|
129 syntax region rcComment start="/\*" end="\*/" contains=rcTodo,rcCommentString,rcCharacter,rcNumber,rcFloat
|
|
130 syntax match rcComment "//.*" contains=rcTodo,rcComment2String,rcCharacter,rcNumber
|
|
131 else
|
|
132 syn region rcComment start="/\*" end="\*/" contains=rcTodo
|
|
133 syn match rcComment "//.*" contains=rcTodo
|
|
134 endif
|
|
135 syntax match rcCommentError "\*/"
|
|
136
|
|
137 syn region rcPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=rcComment,rcString,rcCharacter,rcNumber,rcCommentError
|
|
138 syn region rcIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
|
|
139 syn match rcIncluded contained "<[^>]*>"
|
|
140 syn match rcInclude "^\s*#\s*include\>\s*["<]" contains=rcIncluded
|
|
141 "syn match rcLineSkip "\\$"
|
|
142 syn region rcDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,rcPreCondit,rcIncluded,rcInclude,rcDefine,rcInParen
|
|
143 syn region rcPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,rcPreCondit,rcIncluded,rcInclude,rcDefine,rcInParen
|
|
144
|
|
145 syn sync ccomment rcComment minlines=10
|
|
146
|
|
147 " Define the default highlighting.
|
|
148 " For version 5.7 and earlier: only when not done already
|
|
149 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
150 if version >= 508 || !exists("did_rc_syntax_inits")
|
|
151 if version < 508
|
|
152 let did_rc_syntax_inits = 1
|
|
153 command -nargs=+ HiLink hi link <args>
|
|
154 else
|
|
155 command -nargs=+ HiLink hi def link <args>
|
|
156 endif
|
|
157
|
|
158 HiLink rcCharacter Character
|
|
159 HiLink rcSpecialCharacter rcSpecial
|
|
160 HiLink rcNumber Number
|
|
161 HiLink rcFloat Float
|
|
162 HiLink rcOctalError rcError
|
|
163 HiLink rcParenError rcError
|
|
164 HiLink rcInParen rcError
|
|
165 HiLink rcCommentError rcError
|
|
166 HiLink rcInclude Include
|
|
167 HiLink rcPreProc PreProc
|
|
168 HiLink rcDefine Macro
|
|
169 HiLink rcIncluded rcString
|
|
170 HiLink rcError Error
|
|
171 HiLink rcPreCondit PreCondit
|
|
172 HiLink rcCommentString rcString
|
|
173 HiLink rcComment2String rcString
|
|
174 HiLink rcCommentSkip rcComment
|
|
175 HiLink rcString String
|
|
176 HiLink rcComment Comment
|
|
177 HiLink rcSpecial SpecialChar
|
|
178 HiLink rcTodo Todo
|
|
179
|
|
180 HiLink rcAttribute rcCommonAttribute
|
|
181 HiLink rcStdId rcStatement
|
|
182 HiLink rcStatement Statement
|
|
183
|
|
184 " Default color overrides
|
|
185 hi def rcLanguage term=reverse ctermbg=Red ctermfg=Yellow guibg=Red guifg=Yellow
|
|
186 hi def rcMainObject term=underline ctermfg=Blue guifg=Blue
|
|
187 hi def rcSubObject ctermfg=Green guifg=Green
|
|
188 hi def rcCaptionParam term=underline ctermfg=DarkGreen guifg=Green
|
|
189 hi def rcParam ctermfg=DarkGreen guifg=DarkGreen
|
|
190 hi def rcStatement ctermfg=DarkGreen guifg=DarkGreen
|
|
191 hi def rcCommonAttribute ctermfg=Brown guifg=Brown
|
|
192
|
|
193 "HiLink rcIdentifier Identifier
|
|
194
|
|
195 delcommand HiLink
|
|
196 endif
|
|
197
|
|
198 let b:current_syntax = "rc"
|
|
199
|
|
200 " vim: ts=8
|