blob: 517a20d81738c694cdf8a452e2f34be90ed1000f [file] [log] [blame]
Bram Moolenaara5792f52005-11-23 21:25:05 +00001" Vim syntax file
2" Language: ColdFusion
3" Maintainer: Toby Woodwark (toby.woodwark+vim@gmail.com)
4" Last Change: 2005-11-02
5" Filenames: *.cfc *.cfm
6" Version: Macromedia ColdFusion MX 7
7" Usage: Note that ColdFusion has its own comment syntax
8" i.e. <!--- --->
9
10" For version 5.x, clear all syntax items.
11" For version 6.x+, quit if a syntax file is already loaded.
12if version < 600
13 syntax clear
14elseif exists("b:current_syntax")
15 finish
16endif
17
18" Use all the stuff from the HTML syntax file.
19" TODO remove this; CFML is not a superset of HTML
20if version < 600
21 source <sfile>:p:h/html.vim
22else
23 runtime! syntax/html.vim
24endif
25
26syn sync fromstart
27syn sync maxlines=200
28syn case ignore
29
30" Scopes and keywords.
31syn keyword cfScope contained cgi cffile request caller this thistag cfcatch variables application server session client form url attributes arguments
32syn keyword cfBool contained yes no true false
33
34" Operator strings.
35" Not exhaustive, since there are longhand equivalents.
36syn keyword cfOperator contained xor eqv and or lt le lte gt ge gte eq neq not is mod contains
37syn match cfOperatorMatch contained "[\+\-\*\/\\\^\&][\+\-\*\/\\\^\&]\@!"
38syn cluster cfOperatorCluster contains=cfOperator,cfOperatorMatch
39
40" Tag names.
41syn keyword cfTagName contained cfabort cfapplet cfapplication cfargument cfassociate cfbreak cfcache
42syn keyword cfTagName contained cfcalendar cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection
43syn keyword cfTagName contained cfcomponent cfcontent cfcookie cfdefaultcase cfdirectory cfdocument
44syn keyword cfTagName contained cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror cfexecute
45syn keyword cfTagName contained cfexit cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid
46syn keyword cfTagName contained cfgridcolumn cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif
47syn keyword cfTagName contained cfimport cfinclude cfindex cfinput cfinsert cfinvoke cfinvokeargument
48syn keyword cfTagName contained cfldap cflocation cflock cflog cflogin cfloginuser cflogout cfloop cfmail
49syn keyword cfTagName contained cfmailparam cfmailpart cfmodule cfNTauthenticate cfobject cfobjectcache
50syn keyword cfTagName contained cfoutput cfparam cfpop cfprocessingdirective cfprocparam cfprocresult
51syn keyword cfTagName contained cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow
52syn keyword cfTagName contained cfreturn cfsavecontent cfschedule cfscript cfsearch cfselect cfset cfsetting
53syn keyword cfTagName contained cfsilent cfslider cfstoredproc cfswitch cftable cftextarea cfthrow cftimer
54syn keyword cfTagName contained cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx cfxml
55
56" Tag parameters.
57syn keyword cfArg contained abort accept access accessible action addnewline addtoken addtoken agentname
58syn keyword cfArg contained align appendkey appletsource application applicationtimeout applicationtoken
59syn keyword cfArg contained archive argumentcollection arguments asciiextensionlist attachmentpath
60syn keyword cfArg contained attributecollection attributes attributes autowidth backgroundcolor
61syn keyword cfArg contained backgroundvisible basetag bcc bgcolor bind bindingname blockfactor body bold
62syn keyword cfArg contained border branch cachedafter cachedwithin casesensitive categories category
63syn keyword cfArg contained categorytree cc cfsqltype charset chartheight chartwidth checked class
64syn keyword cfArg contained clientmanagement clientstorage codebase colheaderalign colheaderbold
65syn keyword cfArg contained colheaderfont colheaderfontsize colheaderitalic colheaders colheadertextcolor
66syn keyword cfArg contained collection colorlist colspacing columns completepath component condition
67syn keyword cfArg contained connection contentid context contextbytes contexthighlightbegin
68syn keyword cfArg contained contexthighlightend contextpassages cookiedomain criteria custom1 custom2
69syn keyword cfArg contained custom3 custom4 data dataalign databackgroundcolor datacollection
70syn keyword cfArg contained datalabelstyle datasource date daynames dbname dbserver dbtype dbvarname debug
71syn keyword cfArg contained default delete deletebutton deletefile delimiter delimiters description
72syn keyword cfArg contained destination detail directory disabled display displayname disposition dn domain
73syn keyword cfArg contained enablecab enablecfoutputonly enabled encoded encryption enctype enddate
74syn keyword cfArg contained endrange endrow endtime entry errorcode exception existing expand expires
75syn keyword cfArg contained expireurl expression extendedinfo extends extensions external failifexists
76syn keyword cfArg contained failto file filefield filename filter firstdayofweek firstrowasheaders font
77syn keyword cfArg contained fontbold fontembed fontitalic fontsize foregroundcolor format formfields
78syn keyword cfArg contained formula from generateuniquefilenames getasbinary grid griddataalign gridlines
79syn keyword cfArg contained groovecolor group groupcasesensitive header headeralign headerbold headerfont
80syn keyword cfArg contained headerfontsize headeritalic headerlines headertextcolor height highlighthref
81syn keyword cfArg contained hint href hrefkey hscroll hspace htmltable id idletimeout img imgopen imgstyle
82syn keyword cfArg contained index inline input insert insertbutton interval isolation italic item
83syn keyword cfArg contained itemcolumn key keyonly label labelformat language list listgroups locale
84syn keyword cfArg contained localfile log loginstorage lookandfeel mailerid mailto marginbottom marginleft
85syn keyword cfArg contained marginright marginright margintop markersize markerstyle mask maxlength maxrows
86syn keyword cfArg contained message messagenumber method mimeattach mimetype mode modifytype monthnames
87syn keyword cfArg contained multipart multiple name namecomplict nameconflict namespace new newdirectory
88syn keyword cfArg contained notsupported null numberformat object omit onchange onclick onerror onkeydown
89syn keyword cfArg contained onkeyup onload onmousedown onmouseup onreset onsubmit onvalidate operation
90syn keyword cfArg contained orderby orientation output outputfile overwrite ownerpassword pageencoding
91syn keyword cfArg contained pageheight pagetype pagewidth paintstyle param_1 param_2 param_3 param_4
92syn keyword cfArg contained param_5 parent passive passthrough password path pattern permissions picturebar
93syn keyword cfArg contained pieslicestyle port porttypename prefix preloader preservedata previouscriteria
94syn keyword cfArg contained procedure protocol provider providerdsn proxybypass proxypassword proxyport
95syn keyword cfArg contained proxyserver proxyuser publish query queryasroot queryposition range rebind
96syn keyword cfArg contained recurse redirect referral refreshlabel remotefile replyto report requesttimeout
97syn keyword cfArg contained required reset resolveurl result resultset retrycount returnasbinary returncode
98syn keyword cfArg contained returntype returnvariable roles rowheaderalign rowheaderbold rowheaderfont
99syn keyword cfArg contained rowheaderfontsize rowheaderitalic rowheaders rowheadertextcolor rowheaderwidth
100syn keyword cfArg contained rowheight scale scalefrom scaleto scope scriptprotect scriptsrc secure
101syn keyword cfArg contained securitycontext select selectcolor selected selecteddate selectedindex
102syn keyword cfArg contained selectmode separator seriescolor serieslabel seriesplacement server serviceport
103syn keyword cfArg contained serviceportname sessionmanagement sessiontimeout setclientcookies setcookie
104syn keyword cfArg contained setdomaincookies show3d showborder showdebugoutput showerror showlegend
105syn keyword cfArg contained showmarkers showxgridlines showygridlines size skin sort sortascendingbutton
106syn keyword cfArg contained sortcontrol sortdescendingbutton sortxaxis source spoolenable sql src start
107syn keyword cfArg contained startdate startrange startrow starttime status statuscode statustext step
108syn keyword cfArg contained stoponerror style subject suggestions suppresswhitespace tablename tableowner
109syn keyword cfArg contained tablequalifier taglib target task template text textcolor textqualifier
110syn keyword cfArg contained thread throwonerror throwonfailure throwontimeout time timeout timespan tipbgcolor tipstyle
111syn keyword cfArg contained title to tooltip top toplevelvariable transfermode type uid unit url urlpath
112syn keyword cfArg contained useragent username userpassword usetimezoneinfo validate validateat value
113syn keyword cfArg contained valuecolumn values valuesdelimiter valuesdisplay var variable vertical visible
114syn keyword cfArg contained vscroll vspace webservice width wmode wraptext wsdlfile xaxistitle xaxistype
115syn keyword cfArg contained xoffset yaxistitle yaxistype yoffset
116
117" ColdFusion Functions.
118syn keyword cfFunctionName contained Abs GetFunctionList Max ACos GetGatewayHelper Mid AddSOAPRequestHeader
119syn keyword cfFunctionName contained GetHttpRequestData Min AddSOAPResponseHeader GetHttpTimeString Minute
120syn keyword cfFunctionName contained ArrayAppend GetLocale Month ArrayAvg GetLocaleDisplayName MonthAsString
121syn keyword cfFunctionName contained ArrayClear GetMetaData Now ArrayDeleteAt GetMetricData NumberFormat
122syn keyword cfFunctionName contained ArrayInsertAt GetPageContext ParagraphFormat ArrayIsEmpty GetProfileSections
123syn keyword cfFunctionName contained ParseDateTime ArrayLen GetProfileString Pi ArrayMax GetSOAPRequest
124syn keyword cfFunctionName contained PreserveSingleQuotes ArrayMin GetSOAPRequestHeader Quarter ArrayNew
125syn keyword cfFunctionName contained GetSOAPResponse QueryAddColumn ArrayPrepend GetSOAPResponseHeader QueryAddRow
126syn keyword cfFunctionName contained ArrayResize GetTempDirectory QueryNew ArraySet GetTempFile QuerySetCell
127syn keyword cfFunctionName contained ArraySort GetTickCount QuotedValueList ArraySum GetTimeZoneInfo Rand ArraySwap
128syn keyword cfFunctionName contained GetToken Randomize ArrayToList Hash RandRange Asc Hour REFind ASin
129syn keyword cfFunctionName contained HTMLCodeFormat REFindNoCase Atn HTMLEditFormat ReleaseComObject BinaryDecode
130syn keyword cfFunctionName contained IIf RemoveChars BinaryEncode IncrementValue RepeatString BitAnd InputBaseN
131syn keyword cfFunctionName contained Replace BitMaskClear Insert ReplaceList BitMaskRead Int ReplaceNoCase
132syn keyword cfFunctionName contained BitMaskSet IsArray REReplace BitNot IsBinary REReplaceNoCase BitOr IsBoolean
133syn keyword cfFunctionName contained Reverse BitSHLN IsCustomFunction Right BitSHRN IsDate RJustify BitXor
134syn keyword cfFunctionName contained IsDebugMode Round Ceiling IsDefined RTrim CharsetDecode IsLeapYear Second
135syn keyword cfFunctionName contained CharsetEncode IsNumeric SendGatewayMessage Chr IsNumericDate SetEncoding
136syn keyword cfFunctionName contained CJustify IsObject SetLocale Compare IsQuery SetProfileString CompareNoCase
137syn keyword cfFunctionName contained IsSimpleValue SetVariable Cos IsSOAPRequest Sgn CreateDate IsStruct Sin
138syn keyword cfFunctionName contained CreateDateTime IsUserInRole SpanExcluding CreateObject IsValid SpanIncluding
139syn keyword cfFunctionName contained CreateODBCDate IsWDDX Sqr CreateODBCDateTime IsXML StripCR CreateODBCTime
140syn keyword cfFunctionName contained IsXmlAttribute StructAppend CreateTime IsXmlDoc StructClear CreateTimeSpan
141syn keyword cfFunctionName contained IsXmlElem StructCopy CreateUUID IsXmlNode StructCount DateAdd IsXmlRoot
142syn keyword cfFunctionName contained StructDelete DateCompare JavaCast StructFind DateConvert JSStringFormat
143syn keyword cfFunctionName contained StructFindKey DateDiff LCase StructFindValue DateFormat Left StructGet
144syn keyword cfFunctionName contained DatePart Len StructInsert Day ListAppend StructIsEmpty DayOfWeek
145syn keyword cfFunctionName contained ListChangeDelims StructKeyArray DayOfWeekAsString ListContains StructKeyExists
146syn keyword cfFunctionName contained DayOfYear ListContainsNoCase StructKeyList DaysInMonth ListDeleteAt StructNew
147syn keyword cfFunctionName contained DaysInYear ListFind StructSort DE ListFindNoCase StructUpdate DecimalFormat
148syn keyword cfFunctionName contained ListFirst Tan DecrementValue ListGetAt TimeFormat Decrypt ListInsertAt
149syn keyword cfFunctionName contained ToBase64 DeleteClientVariable ListLast ToBinary DirectoryExists ListLen
150syn keyword cfFunctionName contained ToScript DollarFormat ListPrepend ToString Duplicate ListQualify Trim Encrypt
151syn keyword cfFunctionName contained ListRest UCase Evaluate ListSetAt URLDecode Exp ListSort URLEncodedFormat
152syn keyword cfFunctionName contained ExpandPath ListToArray URLSessionFormat FileExists ListValueCount Val Find
153syn keyword cfFunctionName contained ListValueCountNoCase ValueList FindNoCase LJustify Week FindOneOf Log Wrap
154syn keyword cfFunctionName contained FirstDayOfMonth Log10 WriteOutput Fix LSCurrencyFormat XmlChildPos FormatBaseN
155syn keyword cfFunctionName contained LSDateFormat XmlElemNew GetTempDirectory LSEuroCurrencyFormat XmlFormat
156syn keyword cfFunctionName contained GetAuthUser LSIsCurrency XmlGetNodeType GetBaseTagData LSIsDate XmlNew
157syn keyword cfFunctionName contained GetBaseTagList LSIsNumeric XmlParse GetBaseTemplatePath LSNumberFormat
158syn keyword cfFunctionName contained XmlSearch GetClientVariablesList LSParseCurrency XmlTransform
159syn keyword cfFunctionName contained GetCurrentTemplatePath LSParseDateTime XmlValidate GetDirectoryFromPath
160syn keyword cfFunctionName contained LSParseEuroCurrency Year GetEncoding LSParseNumber YesNoFormat GetException
161syn keyword cfFunctionName contained LSTimeFormat GetFileFromPath LTrim
162
163syn cluster htmlTagNameCluster add=cfTagName
164syn cluster htmlArgCluster add=cfArg,cfHashRegion,cfScope
165syn cluster htmlPreproc add=cfHashRegion
166
167syn cluster cfExpressionCluster contains=cfFunctionName,cfScope,@cfOperatorCluster,cfScriptStringD,cfScriptStringS,cfScriptNumber,cfBool
168
169" Evaluation; skip strings ( this helps with cases like nested IIf() )
170syn region cfHashRegion start=+#+ skip=+"[^"]*"\|'[^']*'+ end=+#+ contains=@cfExpressionCluster,cfScriptParenError
171
172" <cfset>, <cfif>, <cfelseif>, <cfreturn> are analogous to hashmarks (implicit evaluation) and has 'var'
173syn region cfSetRegion start="<cfset " start="<cfreturn " start="<cfelseif " start="<cfif " end='>' keepend contains=@cfExpressionCluster,cfSetLHSRegion,cfSetTagEnd,cfScriptType
174syn region cfSetLHSRegion contained start="<cfreturn" start="<cfelseif" start="<cfif" start="<cfset" end=" " keepend contains=cfTagName,htmlTag
175syn match cfSetTagEnd contained '>'
176
177" CF comments: similar to SGML comments
178syn region cfComment start='<!---' end='--->' keepend contains=cfCommentTodo
179syn keyword cfCommentTodo contained TODO FIXME XXX TBD WTF
180
181" CFscript
182syn match cfScriptLineComment contained "\/\/.*$" contains=cfCommentTodo
183syn region cfScriptComment contained start="/\*" end="\*/" contains=cfCommentTodo
184" in CF, quotes are escaped by doubling
185syn region cfScriptStringD contained start=+"+ skip=+\\\\\|""+ end=+"+ extend contains=@htmlPreproc,cfHashRegion
186syn region cfScriptStringS contained start=+'+ skip=+\\\\\|''+ end=+'+ extend contains=@htmlPreproc,cfHashRegion
187syn match cfScriptNumber contained "-\=\<\d\+L\=\>"
188syn keyword cfScriptConditional contained if else
189syn keyword cfScriptRepeat contained while for in
190syn keyword cfScriptBranch contained break switch case try catch continue
191syn keyword cfScriptFunction contained function
192syn keyword cfScriptType contained var
193syn match cfScriptBraces contained "[{}]"
194syn keyword cfScriptStatement contained return
195
196syn cluster cfScriptCluster contains=cfScriptParen,cfScriptLineComment,cfScriptComment,cfScriptStringD,cfScriptStringS,cfScriptFunction,cfScriptNumber,cfScriptRegexpString,cfScriptBoolean,cfScriptBraces,cfHashRegion,cfFunctionName,cfScope,@cfOperatorCluster,cfScriptConditional,cfScriptRepeat,cfScriptBranch,cfScriptType,@cfExpressionCluster,cfScriptStatement
197
198" Errors caused by wrong parenthesis; skip strings
199syn region cfScriptParen contained transparent skip=+"[^"]*"\|'[^']*'+ start=+(+ end=+)+ contains=@cfScriptCluster
200syn match cfScrParenError contained +)+
201
202syn region cfscriptBlock matchgroup=NONE start="<cfscript>" end="<\/cfscript>"me=s-1 keepend contains=@cfScriptCluster,cfscriptTag,cfScrParenError
203syn region cfscriptTag contained start='<cfscript' end='>' keepend contains=cfTagName,htmlTag
204
205" Define the default highlighting.
206if version >= 508 || !exists("did_cf_syn_inits")
207 if version < 508
208 let did_cf_syn_inits = 1
209 command -nargs=+ HiLink hi link <args>
210 else
211 command -nargs=+ HiLink hi def link <args>
212 endif
213
214 HiLink cfTagName Statement
215 HiLink cfArg Type
216 HiLink cfFunctionName Function
217 HiLink cfHashRegion PreProc
218 HiLink cfComment Comment
219 HiLink cfCommentTodo Todo
220 HiLink cfOperator Operator
221 HiLink cfOperatorMatch Operator
222 HiLink cfScope Title
223 HiLink cfBool Constant
224
225 HiLink cfscriptBlock Special
226 HiLink cfscriptTag htmlTag
227 HiLink cfSetRegion PreProc
228 HiLink cfSetLHSRegion htmlTag
229 HiLink cfSetTagEnd htmlTag
230
231 HiLink cfScriptLineComment Comment
232 HiLink cfScriptComment Comment
233 HiLink cfScriptStringS String
234 HiLink cfScriptStringD String
235 HiLink cfScriptNumber cfScriptValue
236 HiLink cfScriptConditional Conditional
237 HiLink cfScriptRepeat Repeat
238 HiLink cfScriptBranch Conditional
239 HiLink cfScriptType Type
240 HiLink cfScriptStatement Statement
241 HiLink cfScriptBraces Function
242 HiLink cfScriptFunction Function
243 HiLink cfScriptError Error
244 HiLink cfScrParenError cfScriptError
245
246 delcommand HiLink
247endif
248
249let b:current_syntax = "cf"
250
251" vim: ts=8 sw=2