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