2 " Language: Microsoft VBScript Web Content (ASP)
3 " Maintainer: Devin Weaver <ktohg@tritarget.com>
4 " URL: http://tritarget.com/pub/vim/syntax/aspvbs.vim
5 " Last Change: 2001 May 10
7 " Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
14 if !exists("main_syntax")
15 let main_syntax = 'aspvbs'
19 source <sfile>:p:h/html.vim
21 runtime! syntax/html.vim
23 unlet b:current_syntax
25 syn cluster htmlPreProc add=AspVBScriptInsideHtmlTags
27 " Functions and methods that are in VB but will cause errors in an ASP page
28 " This is helpfull if your porting VB code to ASP
29 " I removed (Count, Item) because these are common variable names in AspVBScript
30 syn keyword AspVBSError contained Val Str CVar CVDate DoEvents GoSub Return GoTo
31 syn keyword AspVBSError contained Date Time Timer Stop LinkExecute
32 syn keyword AspVBSError contained Add With Type LinkPoke
33 syn keyword AspVBSError contained LinkRequest LinkSend Declare New Optional Sleep
34 syn keyword AspVBSError contained ParamArray Static Erl TypeOf Like LSet RSet Mid StrConv
35 " It may seem that most of these can fit into a keyword clause but keyword takes
36 " priority over all so I can't get the multi-word matches
37 syn match AspVBSError contained "\<Def[a-zA-Z0-9_]\+\>"
38 syn match AspVBSError contained "^\s*Open"
39 syn match AspVBSError contained "Debug\.[a-zA-Z0-9_]*"
40 syn match AspVBSError contained "^\s*[a-zA-Z0-9_]\+:"
41 syn match AspVBSError contained "[a-zA-Z0-9_]\+![a-zA-Z0-9_]\+"
42 syn match AspVBSError contained "^\s*#.*$"
43 syn match AspVBSError contained "\<As\s\+[a-zA-Z0-9_]*"
44 syn match AspVBSError contained "\<End\>\|\<Exit\>"
45 syn match AspVBSError contained "\<On\s\+Error\>\|\<On\>\|\<Error\>\|\<Resume\s\+Next\>\|\<Resume\>"
46 syn match AspVBSError contained "\<Option\s\+\(Base\|Compare\|Private\s\+Module\)\>"
47 syn match AspVBSError contained "\<Property\s\+\(Get\|Let\|Set\)\>"
49 " AspVBScript Reserved Words.
50 syn match AspVBSStatement contained "\<On\s\+Error\s\+\(Resume\s\+Next\|goto\s\+0\)\>\|\<Next\>"
51 syn match AspVBSStatement contained "\<End\s\+\(If\|For\|Select\|Function\|Sub\)\>"
52 syn match AspVBSStatement contained "\<Exit\s\+\(Do\|For\|Sub\|Function\)\>"
53 syn match AspVBSStatement contained "\<Option\s\+Explicit\>"
54 syn match AspVBSStatement contained "\<For\s\+Each\>\|\<For\>"
55 syn match AspVBSStatement contained "\<Set\>"
56 syn keyword AspVBSStatement contained Call Const Dim Do Loop Erase And
57 syn keyword AspVBSStatement contained Function If Then Else ElseIf Or
58 syn keyword AspVBSStatement contained Private Public Randomize ReDim
59 syn keyword AspVBSStatement contained Select Case Sub While Wend Not
61 " AspVBScript Functions
62 syn keyword AspVBSFunction contained Abs Array Asc Atn CBool CByte CCur CDate CDbl
63 syn keyword AspVBSFunction contained Chr CInt CLng Cos CreateObject CSng CStr Date
64 syn keyword AspVBSFunction contained DateAdd DateDiff DatePart DateSerial DateValue
65 syn keyword AspVBSFunction contained Day Exp Filter Fix FormatCurrency
66 syn keyword AspVBSFunction contained FormatDateTime FormatNumber FormatPercent
67 syn keyword AspVBSFunction contained GetObject Hex Hour InputBox InStr InStrRev Int
68 syn keyword AspVBSFunction contained IsArray IsDate IsEmpty IsNull IsNumeric
69 syn keyword AspVBSFunction contained IsObject Join LBound LCase Left Len LoadPicture
70 syn keyword AspVBSFunction contained Log LTrim Mid Minute Month MonthName MsgBox Now
71 syn keyword AspVBSFunction contained Oct Replace RGB Right Rnd Round RTrim
72 syn keyword AspVBSFunction contained ScriptEngine ScriptEngineBuildVersion
73 syn keyword AspVBSFunction contained ScriptEngineMajorVersion
74 syn keyword AspVBSFunction contained ScriptEngineMinorVersion Second Sgn Sin Space
75 syn keyword AspVBSFunction contained Split Sqr StrComp StrReverse String Tan Time
76 syn keyword AspVBSFunction contained TimeSerial TimeValue Trim TypeName UBound UCase
77 syn keyword AspVBSFunction contained VarType Weekday WeekdayName Year
80 syn keyword AspVBSMethods contained Add AddFolders BuildPath Clear Close Copy
81 syn keyword AspVBSMethods contained CopyFile CopyFolder CreateFolder CreateTextFile
82 syn keyword AspVBSMethods contained Delete DeleteFile DeleteFolder DriveExists
83 syn keyword AspVBSMethods contained Exists FileExists FolderExists
84 syn keyword AspVBSMethods contained GetAbsolutePathName GetBaseName GetDrive
85 syn keyword AspVBSMethods contained GetDriveName GetExtensionName GetFile
86 syn keyword AspVBSMethods contained GetFileName GetFolder GetParentFolderName
87 syn keyword AspVBSMethods contained GetSpecialFolder GetTempName Items Keys Move
88 syn keyword AspVBSMethods contained MoveFile MoveFolder OpenAsTextStream
89 syn keyword AspVBSMethods contained OpenTextFile Raise Read ReadAll ReadLine Remove
90 syn keyword AspVBSMethods contained RemoveAll Skip SkipLine Write WriteBlankLines
91 syn keyword AspVBSMethods contained WriteLine
93 " AspVBScript Number Contstants
94 " Integer number, or floating point number without a dot.
95 syn match AspVBSNumber contained "\<\d\+\>"
96 " Floating point number, with dot
97 syn match AspVBSNumber contained "\<\d\+\.\d*\>"
98 " Floating point number, starting with a dot
99 syn match AspVBSNumber contained "\.\d\+\>"
101 " String and Character Contstants
102 " removed (skip=+\\\\\|\\"+) because VB doesn't have backslash escaping in
103 " strings (or does it?)
104 syn region AspVBSString contained start=+"+ end=+"+ keepend
106 " AspVBScript Comments
107 syn region AspVBSComment contained start="^REM\s\|\sREM\s" end="$" contains=AspVBSTodo keepend
108 syn region AspVBSComment contained start="^'\|\s'" end="$" contains=AspVBSTodo keepend
109 " misc. Commenting Stuff
110 syn keyword AspVBSTodo contained TODO FIXME
112 " Cosmetic syntax errors commanly found in VB but not in AspVBScript
113 " AspVBScript doesn't use line numbers
114 syn region AspVBSError contained start="^\d" end="\s" keepend
115 " AspVBScript also doesn't have type defining variables
116 syn match AspVBSError contained "[a-zA-Z0-9_][\$&!#]"ms=s+1
117 " Since 'a%' is a VB variable with a type and in AspVBScript you can have 'a%>'
118 " I have to make a special case so 'a%>' won't show as an error.
119 syn match AspVBSError contained "[a-zA-Z0-9_]%\($\|[^>]\)"ms=s+1
122 syn cluster AspVBScriptTop contains=AspVBSStatement,AspVBSFunction,AspVBSMethods,AspVBSNumber,AspVBSString,AspVBSComment,AspVBSError
124 " Define AspVBScript delimeters
125 " <%= func("string_with_%>_in_it") %> This is illegal in ASP syntax.
126 syn region AspVBScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<%=\=+ end=+%>+ contains=@AspVBScriptTop
127 syn region AspVBScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<script\s\+language="\=vbscript"\=[^>]*\s\+runatserver[^>]*>+ end=+</script>+ contains=@AspVBScriptTop
130 syn sync match AspVBSSyncGroup grouphere AspVBScriptInsideHtmlTags "<%"
131 " This is a kludge so the HTML will sync properly
132 syn sync match htmlHighlight groupthere htmlTag "%>"
134 " Define the default highlighting.
135 " For version 5.7 and earlier: only when not done already
136 " For version 5.8 and later: only when an item doesn't have highlighting yet
137 if version >= 508 || !exists("did_aspvbs_syn_inits")
139 let did_aspvbs_syn_inits = 1
140 command -nargs=+ HiLink hi link <args>
142 command -nargs=+ HiLink hi def link <args>
145 "HiLink AspVBScript Special
146 HiLink AspVBSLineNumber Comment
147 HiLink AspVBSNumber Number
148 HiLink AspVBSError Error
149 HiLink AspVBSStatement Statement
150 HiLink AspVBSString String
151 HiLink AspVBSComment Comment
152 HiLink AspVBSTodo Todo
153 HiLink AspVBSFunction Identifier
154 HiLink AspVBSMethods PreProc
155 HiLink AspVBSEvents Special
156 HiLink AspVBSTypeSpecifier Type
161 let b:current_syntax = "aspvbs"
163 if main_syntax == 'aspvbs'
167 " vim: ts=8:sw=2:sts=0:noet