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