2 " Language: Visual Basic
3 " Maintainer: Robert M. Cortopassi <cortopar@mindspring.com>
4 " Last Change: 2001 May 09
6 " This was thrown together after seeing numerous requests on the
7 " VIM and VIM-DEV mailing lists. It is by no means complete.
8 " Send comments, suggestions and requests to the maintainer.
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
14 elseif exists("b:current_syntax")
18 " VB is case insensitive
21 syn keyword vbStatement AppActivate Base Beep Call Case ChDir ChDrive Const
22 syn keyword vbStatement Declare DefBool DefByte DefCur DefDate DefDbl DefDec
23 syn keyword vbStatement DefInt DefLng DefObj DefSng DefStr Deftype DefVar
24 syn keyword vbStatement DeleteSetting Dim Do Else End Enum Erase Event Exit
25 syn keyword vbStatement Explicit FileCopy For ForEach Function Get GoSub GoTo
26 syn keyword vbStatement If Implements Kill Let LineInput Lock LSet MkDir Name Next
27 syn keyword vbStatement OnError On Option Private Property Public Put RaiseEvent
28 syn keyword vbStatement Randomize ReDim Rem Reset Resume Return RmDir RSet
29 syn keyword vbStatement SavePicture SaveSetting SendKeys SetAttr Static Sub Then
30 syn keyword vbStatement Type Unlock Wend While Width With Write
32 syn keyword vbFunction Abs Array Asc AscB AscW Atn Avg
33 syn keyword vbFunction CBool CByte CCur CDate CDbl Cdec Choose Chr ChrB ChrW
34 syn keyword vbFunction CInt CLng Command Cos Count CreateObject CSng CStr
35 syn keyword vbFunction CurDir CVar CVDate CVErr Date DateAdd DateDiff DatePart
36 syn keyword vbFunction DateSerial DateValue Day DDB Dir DoEvents Environ EOF
37 syn keyword vbFunction Error Exp FileAttr FileDateTime FileLen Fix Format
38 syn keyword vbFunction FreeFile FV GetAllStrings GetAttr GetAutoServerSettings
39 syn keyword vbFunction GetObject GetSetting Hex Hour IIf IMEStatus Input InputB
40 syn keyword vbFunction InputBox InStr InstB Int IPmt IsArray IsDate IsEmpty
41 syn keyword vbFunction IsError IsMissing IsNull IsNumeric IsObject LBound LCase
42 syn keyword vbFunction Left LeftB Len LenB LoadPicture Loc LOF Log LTrim Max
43 syn keyword vbFunction Mid MidB Min Minute MIRR Month MsgBox Now NPer NPV Oct
44 syn keyword vbFunction Partition Pmt PPmt PV QBColor Rate RGB Right RightB Rnd
45 syn keyword vbFunction RTrim Second Seek Sgn Shell Sin SLN Space Spc Sqr StDev
46 syn keyword vbFunction StDevP Str StrComp StrConv String Switch Sum SYD Tab Tan
47 syn keyword vbFunction Time Timer TimeSerial TimeValue Trim TypeName UBound UCase
48 syn keyword vbFunction Val Var VarP VarType Weekday Year
50 syn keyword vbMethods Accept Activate Add AddCustom AddFile AddFromFile
51 syn keyword vbMethods AddFromTemplate AddItem AddNew AddToAddInToolbar
52 syn keyword vbMethods AddToolboxProgID Append AppendChunk Arrange Assert
53 syn keyword vbMethods AsyncRead BatchUpdate BeginTrans Bind Cancel CancelAsyncRead
54 syn keyword vbMethods CancelBatch CancelUpdate CanPropertyChange CaptureImage
55 syn keyword vbMethods CellText CellValue Circle Clear ClearFields ClearSel
56 syn keyword vbMethods ClearSelCols Clone Close Cls ColContaining ColumnSize
57 syn keyword vbMethods CommitTrans CompactDatabase Compose Connect Copy
58 syn keyword vbMethods CopyQueryDef CreateDatabase CreateDragImage CreateEmbed
59 syn keyword vbMethods CreateField CreateGroup CreateIndex CreateLink
60 syn keyword vbMethods CreatePreparedStatement CreatePropery CreateQuery
61 syn keyword vbMethods CreateQueryDef CreateRelation CreateTableDef CreateUser
62 syn keyword vbMethods CreateWorkspace Customize Delete DeleteColumnLabels
63 syn keyword vbMethods DeleteColumns DeleteRowLabels DeleteRows DoVerb Drag Draw
64 syn keyword vbMethods Edit EditCopy EditPaste EndDoc EnsureVisible
65 syn keyword vbMethods EstablishConnection Execute ExtractIcon Fetch FetchVerbs
66 syn keyword vbMethods Files FillCache Find FindFirst FindItem FindLast FindNext
67 syn keyword vbMethods FindPrevious Forward GetBookmark GetChunk GetClipString
68 syn keyword vbMethods GetData GetFirstVisible GetFormat GetHeader GetLineFromChar
69 syn keyword vbMethods GetNumTicks GetRows GetSelectedPart GetText GetVisibleCount
70 syn keyword vbMethods GoBack GoForward Hide HitTest HoldFields Idle
71 syn keyword vbMethods InitializeLabels InsertColumnLabels InsertColumns
72 syn keyword vbMethods InsertObjDlg InsertRowLabels InsertRows Item KillDoc
73 syn keyword vbMethods Layout Line LinkExecute LinkPoke LinkRequest LinkSend Listen
74 syn keyword vbMethods LoadFile LoadResData LoadResPicture LoadResString LogEvent
75 syn keyword vbMethods MakeCompileFile MakeReplica MoreResults Move MoveData
76 syn keyword vbMethods MoveFirst MoveLast MoveNext MovePrevious NavigateTo NewPage
77 syn keyword vbMethods NewPassword NextRecordset OLEDrag OnAddinsUpdate
78 syn keyword vbMethods OnConnection OnDisconnection OnStartupComplete Open
79 syn keyword vbMethods OpenConnection OpenDatabase OpenQueryDef OpenRecordset
80 syn keyword vbMethods OpenResultset OpenURL Overlay PaintPicture Paste
81 syn keyword vbMethods PastSpecialDlg PeekData Play Point PopulatePartial PopupMenu
82 syn keyword vbMethods Print PrintForm PropertyChanged PSet Quit Raise
83 syn keyword vbMethods RandomDataFill RandomFillColumns RandomFillRows
84 syn keyword vbMethods rdoCreateEnvironment rdoRegisterDataSource ReadFromFile
85 syn keyword vbMethods ReadProperty Rebind ReFill Refresh RefreshLink
86 syn keyword vbMethods RegisterDatabase Reload Remove RemoveAddInFromToolbar
87 syn keyword vbMethods RemoveItem Render RepairDatabase Reply ReplyAll Requery
88 syn keyword vbMethods ResetCustom ResetCustomLabel ResolveName RestoreToolbar
89 syn keyword vbMethods Resync Rollback RollbackTrans RowBookmark RowContaining
90 syn keyword vbMethods RowTop Save SaveAs SaveFile SaveToFile SaveToolbar
91 syn keyword vbMethods SaveToOle1File Scale ScaleX ScaleY Scroll Select SelectAll
92 syn keyword vbMethods SelectPart SelPrint Send SendData Set SetAutoServerSettings
93 syn keyword vbMethods SetData SetFocus SetOption SetSize SetText SetViewport Show
94 syn keyword vbMethods ShowColor ShowFont ShowHelp ShowOpen ShowPrinter ShowSave
95 syn keyword vbMethods ShowWhatsThis SignOff SignOn Size Span SplitContaining
96 syn keyword vbMethods StartLabelEdit StartLogging Stop Synchronize TextHeight
97 syn keyword vbMethods TextWidth ToDefaults TwipsToChartPart TypeByChartType
98 syn keyword vbMethods Update UpdateControls UpdateRecord UpdateRow Upto
99 syn keyword vbMethods WhatsThisMode WriteProperty ZOrder
101 syn keyword vbEvents AccessKeyPress AfterAddFile AfterChangeFileName
102 syn keyword vbEvents AfterCloseFile AfterColEdit AfterColUpdate
103 syn keyword vbEvents AfterDelete AfterInsert AfterLabelEdit AfterRemoveFile
104 syn keyword vbEvents AfterUpdate AfterWriteFile AmbienChanged ApplyChanges
105 syn keyword vbEvents Associate AsyncReadComplete AxisActivated AxisLabelActivated
106 syn keyword vbEvents AxisLabelSelected AxisLabelUpdated AxisSelected
107 syn keyword vbEvents AxisTitleActivated AxisTitleSelected AxisTitleUpdated
108 syn keyword vbEvents AxisUpdated BeforeClick BeforeColEdit BeforeColUpdate
109 syn keyword vbEvents BeforeConnect BeforeDelete BeforeInsert BeforeLabelEdit
110 syn keyword vbEvents BeforeLoadFile BeforeUpdate ButtonClick ButtonCompleted
111 syn keyword vbEvents ButtonGotFocus ButtonLostFocus Change ChartActivated
112 syn keyword vbEvents ChartSelected ChartUpdated Click ColEdit Collapse
113 syn keyword vbEvents ColResize ColumnClick Compare ConfigChageCancelled
114 syn keyword vbEvents ConfigChanged ConnectionRequest DataArrival DataChanged
115 syn keyword vbEvents DataUpdated DblClick Deactivate DeviceArrival
116 syn keyword vbEvents DeviceOtherEvent DeviceQueryRemove DeviceQueryRemoveFailed
117 syn keyword vbEvents DeviceRemoveComplete DeviceRemovePending DevModeChange
118 syn keyword vbEvents Disconnect DisplayChanged Dissociate DoGetNewFileName Done
119 syn keyword vbEvents DonePainting DownClick DragDrop DragOver DropDown
120 syn keyword vbEvents EditProperty EnterCell EnterFocus ExitFocus Expand
121 syn keyword vbEvents FootnoteActivated FootnoteSelected FootnoteUpdated GotFocus
122 syn keyword vbEvents HeadClick InfoMessage Initialize IniProperties ItemActivated
123 syn keyword vbEvents ItemAdded ItemCheck ItemClick ItemReloaded ItemRemoved
124 syn keyword vbEvents ItemRenamed ItemSeletected KeyDown KeyPress KeyUp LeaveCell
125 syn keyword vbEvents LegendActivated LegendSelected LegendUpdated LinkClose
126 syn keyword vbEvents LinkError LinkNotify LinkOpen Load LostFocus MouseDown
127 syn keyword vbEvents MouseMove MouseUp NodeClick ObjectMove OLECompleteDrag
128 syn keyword vbEvents OLEDragDrop OLEDragOver OLEGiveFeedback OLESetData
129 syn keyword vbEvents OLEStartDrag OnAddNew OnComm Paint PanelClick PanelDblClick
130 syn keyword vbEvents PathChange PatternChange PlotActivated PlotSelected
131 syn keyword vbEvents PlotUpdated PointActivated PointLabelActivated
132 syn keyword vbEvents PointLabelSelected PointLabelUpdated PointSelected
133 syn keyword vbEvents PointUpdated PowerQuerySuspend PowerResume PowerStatusChanged
134 syn keyword vbEvents PowerSuspend QueryChangeConfig QueryComplete QueryCompleted
135 syn keyword vbEvents QueryTimeout QueryUnload ReadProperties Reposition
136 syn keyword vbEvents RequestChangeFileName RequestWriteFile Resize ResultsChanged
137 syn keyword vbEvents RowColChange RowCurrencyChange RowResize RowStatusChanged
138 syn keyword vbEvents SelChange SelectionChanged SendComplete SendProgress
139 syn keyword vbEvents SeriesActivated SeriesSelected SeriesUpdated SettingChanged
140 syn keyword vbEvents SplitChange StateChanged StatusUpdate SysColorsChanged
141 syn keyword vbEvents Terminate TimeChanged TitleActivated TitleSelected
142 syn keyword vbEvents TitleActivated UnboundAddData UnboundDeleteRow
143 syn keyword vbEvents UnboundGetRelativeBookmark UnboundReadData UnboundWriteData
144 syn keyword vbEvents Unload UpClick Updated Validate ValidationError
145 syn keyword vbEvents WillAssociate WillChangeData WillDissociate WillExecute
146 syn keyword vbEvents WillUpdateRows WriteProperties
148 syn keyword vbTodo contained TODO
150 "integer number, or floating point number without a dot.
151 syn match vbNumber "\<\d\+\>"
152 "floating point number, with dot
153 syn match vbNumber "\<\d\+\.\d*\>"
154 "floating point number, starting with a dot
155 syn match vbNumber "\.\d\+\>"
157 " String and Character contstants
158 syn region vbString start=+"+ end=+"+
159 syn region vbComment start="REM" end="$" contains=vbTodo
160 syn region vbComment start="'" end="$" contains=vbTodo
161 syn region vbLineNumber start="^\d" end="\s"
162 syn match vbTypeSpecifier "[a-zA-Z0-9][\$%&!#]"ms=s+1
164 " Define the default highlighting.
165 " For version 5.7 and earlier: only when not done already
166 " For version 5.8 and later: only when an item doesn't have highlighting yet
167 if version >= 508 || !exists("did_vb_syntax_inits")
169 let did_vb_syntax_inits = 1
170 command -nargs=+ HiLink hi link <args>
172 command -nargs=+ HiLink hi def link <args>
175 HiLink vbLineNumber Comment
176 HiLink vbNumber Number
178 HiLink vbStatement Statement
179 HiLink vbString String
180 HiLink vbComment Comment
182 HiLink vbFunction Identifier
183 HiLink vbMethods PreProc
184 HiLink vbEvents Special
185 HiLink vbTypeSpecifier Type
190 let b:current_syntax = "vb"