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