comparison vendor/vim-syntax/javascript.vim @ 604:d4d316db35d7

Add latestest javascript
author nanaya <me@nanaya.pro>
date Fri, 21 Apr 2017 19:23:36 +0900
parents
children b305f2ce5f88
comparison
equal deleted inserted replaced
603:9f49513d0d24 604:d4d316db35d7
1 " Vim syntax file
2 " Language: JavaScript
3 " Maintainer: Jose Elera Campana <https://github.com/jelera>
4 " Last Modified: Wed 24 Feb 2016 03:35:03 AM CST
5 " Version: 0.8.2
6 " Credits: Zhao Yi, Claudio Fleiner, Scott Shattuck (This file is based
7 " on their hard work), gumnos (From the #vim IRC Channel in
8 " Freenode), all the contributors at this project's github page
9 " (https://github.com/jelera/vim-javascript-syntax/graphs/contributors)
10
11 if !exists("main_syntax")
12 if version < 600
13 syntax clear
14 elseif exists("b:current_syntax")
15 finish
16 endif
17 let main_syntax = 'javascript'
18 endif
19
20 " Drop fold if it set but vim doesn't support it.
21 if version < 600 && exists("javaScript_fold")
22 unlet javaScript_fold
23 endif
24
25 "" Remove dollar sign from identifier when embedded in a PHP file
26 if &filetype == 'javascript'
27 setlocal iskeyword+=$
28 endif
29
30 syntax sync fromstart
31
32 "" syntax coloring for Node.js shebang line
33 syntax match shebang "^#!.*"
34 hi link shebang Comment
35
36 " Statement Keywords {{{
37 syntax keyword javaScriptSource import export from
38 syntax keyword javaScriptIdentifier arguments this let var void yield async await
39 syntax keyword javaScriptOperator delete new instanceof typeof
40 syntax keyword javaScriptBoolean true false
41 syntax keyword javaScriptNull null undefined
42 syntax keyword javaScriptMessage alert confirm prompt status
43 syntax keyword javaScriptGlobal self top parent
44 syntax keyword javaScriptDeprecated escape unescape all applets alinkColor bgColor fgColor linkColor vlinkColor xmlEncoding
45 syntax keyword javaScriptConditional if else switch
46 syntax keyword javaScriptRepeat do while for in of
47 syntax keyword javaScriptBranch break continue
48 syntax keyword javaScriptLabel case default
49 syntax keyword javaScriptPrototype prototype
50 syntax keyword javaScriptStatement return with
51 syntax keyword javaScriptGlobalObjects Array Boolean Date Function Math Number Object RegExp String
52 syntax keyword javaScriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
53 syntax keyword javaScriptReserved abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public
54 "}}}
55 " Comments {{{
56 syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
57 syntax match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo
58 syntax match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
59 syntax region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
60 "}}}
61 " JSDoc support {{{
62 if !exists("javascript_ignore_javaScriptdoc")
63 syntax case ignore
64
65 " syntax coloring for JSDoc comments (HTML)
66 "unlet b:current_syntax
67
68 syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,@javaScriptHtml,jsInJsdocExample,@Spell fold
69 syntax match javaScriptDocTags contained "@\(abstract\|access\|alias\|arg\|argument\|augments\|author\|borrows\|callback\|class\|classdesc\|const\|constant\|constructor\|constructs\|copyright\|default\|defaultvalue\|deprecated\|desc\|description\|emits\|enum\|event\|example\|exception\|exports\|extends\|external\|file\|fileoverview\|fires\|func\|function\|global\|host\|ignore\|implements\|inheritdoc\|inner\|instance\|interface\|kind\|lends\|license\|link\|linkcode\|linkplain\|listens\|member\|memberof\|method\|mixes\|mixin\|module\|name\|namespace\|override\|overview\|param\|private\|prop\|property\|cfg\|protected\|public\|readonly\|requires\|return\|returns\|see\|since\|static\|summary\|this\|throws\|todo\|tutorial\|tutorial\|type\|typedef\|var\|variation\|version\|virtual\)\>" nextgroup=javaScriptDocParam,javaScriptDocSeeTag skipwhite
70 syntax match javaScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
71 syntax region javaScriptDocSeeTag contained matchgroup=javaScriptDocSeeTag start="{" end="}" contains=javaScriptDocTags
72
73 syntax case match
74 endif
75 syntax case match
76 "}}}
77 " Strings, Numbers and Regex Highlight {{{
78 syntax match javaScriptSpecial "\\\d\d\d\|\\."
79 syntax region javaScriptString start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
80 syntax region javaScriptString start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
81
82 syntax match javaScriptSpecialCharacter "'\\.'"
83 syntax match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
84 syntax region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gim]\{0,2\}\s*$+ end=+/[gim]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
85 syntax match javaScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
86 "}}}
87 " DOM, Browser and Ajax Support {{{
88 syntax keyword javaScriptBrowserObjects window navigator screen history location console
89
90 syntax keyword javaScriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea
91 syntax keyword javaScriptDOMMethods createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode
92 syntax keyword javaScriptDOMProperties nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName
93
94 syntax keyword javaScriptAjaxObjects XMLHttpRequest
95 syntax keyword javaScriptAjaxProperties readyState responseText responseXML statusText
96 syntax keyword javaScriptAjaxMethods onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader
97
98 syntax keyword javaScriptPropietaryObjects ActiveXObject
99 syntax keyword javaScriptPropietaryMethods attachEvent detachEvent cancelBubble returnValue
100
101 syntax keyword javaScriptHtmlElemProperties className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title
102
103 syntax keyword javaScriptEventListenerKeywords blur click focus mouseover mouseout load item
104
105 syntax keyword javaScriptEventListenerMethods scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation
106 " }}}
107 " DOM/HTML5/CSS specified things {{{
108 " Web API Interfaces (very long list of keywords) {{{
109 syntax keyword javaScriptWebAPI AbstractWorker AnalyserNode AnimationEvent App Apps ArrayBuffer ArrayBufferView Attr AudioBuffer AudioBufferSourceNode AudioContext AudioDestinationNode AudioListener AudioNode AudioParam AudioProcessingEvent BatteryManager BiquadFilterNode Blob BlobBuilder BlobEvent CallEvent CameraCapabilities CameraControl CameraManager CanvasGradient CanvasImageSource CanvasPattern CanvasPixelArray CanvasRenderingContext2D CaretPosition CDATASection ChannelMergerNode ChannelSplitterNode CharacterData ChildNode ChromeWorker ClipboardEvent CloseEvent Comment CompositionEvent Connection Console ContactManager ConvolverNode Coordinates CSS CSSConditionRule CSSGroupingRule CSSKeyframeRule CSSKeyframesRule CSSMediaRule CSSNamespaceRule CSSPageRule CSSRule CSSRuleList CSSStyleDeclaration CSSStyleRule CSSStyleSheet CSSSupportsRule CustomEvent
110 syntax keyword javaScriptWebAPI DataTransfer DataView DedicatedWorkerGlobalScope DelayNode DeviceAcceleration DeviceLightEvent DeviceMotionEvent DeviceOrientationEvent DeviceProximityEvent DeviceRotationRate DeviceStorage DeviceStorageChangeEvent DirectoryEntry DirectoryEntrySync DirectoryReader DirectoryReaderSync Document DocumentFragment DocumentTouch DocumentType DOMConfiguration DOMCursor DOMError DOMErrorHandler DOMException DOMHighResTimeStamp DOMImplementation DOMImplementationList DOMImplementationSource DOMLocator DOMObject DOMParser DOMRequest DOMString DOMStringList DOMStringMap DOMTimeStamp DOMTokenList DOMUserData DynamicsCompressorNode
111 syntax keyword javaScriptWebAPI Element ElementTraversal Entity EntityReference Entry EntrySync ErrorEvent Event EventListener EventSource EventTarget Extensions File FileEntry FileEntrySync FileError FileException FileList FileReader FileSystem FileSystemSync Float32Array Float64Array FMRadio FocusEvent FormData GainNode Geolocation History
112 syntax keyword javaScriptWebAPI HTMLAnchorElement HTMLAreaElement HTMLAudioElement HTMLBaseElement HTMLBaseFontElement HTMLBodyElement HTMLBRElement HTMLButtonElement HTMLCanvasElement HTMLCollection HTMLDataElement HTMLDataListElement HTMLDivElement HTMLDListElement HTMLDocument HTMLElement HTMLEmbedElement HTMLFieldSetElement HTMLFormControlsCollection HTMLFormElement HTMLHeadElement HTMLHeadingElement HTMLHRElement HTMLHtmlElement HTMLIFrameElement HTMLImageElement HTMLInputElement HTMLIsIndexElement HTMLKeygenElement HTMLLabelElement HTMLLegendElement HTMLLIElement HTMLLinkElement HTMLMapElement HTMLMediaElement HTMLMetaElement HTMLMeterElement HTMLModElement HTMLObjectElement HTMLOListElement HTMLOptGroupElement HTMLOptionElement HTMLOptionsCollection HTMLOutputElement HTMLParagraphElement HTMLParamElement HTMLPreElement HTMLProgressElement HTMLQuoteElement HTMLScriptElement HTMLSelectElement HTMLSourceElement HTMLSpanElement HTMLStyleElement HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableRowElement HTMLTableSectionElement HTMLTextAreaElement HTMLTimeElement HTMLTitleElement HTMLTrackElement HTMLUListElement HTMLUnknownElement HTMLVideoElement
113 syntax keyword javaScriptWebAPI IDBCursor IDBCursorWithValue IDBDatabase IDBDatabaseException IDBEnvironment IDBFactory IDBIndex IDBKeyRange IDBObjectStore IDBOpenDBRequest IDBRequest IDBTransaction IDBVersionChangeEvent ImageData Int16Array Int32Array Int8Array KeyboardEvent LinkStyle LocalFileSystem LocalFileSystemSync Location MediaQueryList MediaQueryListListener MediaSource MediaStream MediaStreamTrack MessageEvent MouseEvent MouseScrollEvent MouseWheelEvent MozActivity MozActivityOptions MozActivityRequestHandler MozAlarmsManager MozContact MozContactChangeEvent MozIccManager MozMmsEvent MozMmsMessage MozMobileCellInfo MozMobileCFInfo MozMobileConnection MozMobileConnectionInfo MozMobileICCInfo MozMobileMessageManager MozMobileMessageThread MozMobileNetworkInfo MozNetworkStats MozNetworkStatsData MozNetworkStatsManager MozSettingsEvent MozSmsEvent MozSmsFilter MozSmsManager MozSmsMessage MozSmsSegmentInfo MozTimeManager MozWifiConnectionInfoEvent MutationObserver
114 syntax keyword javaScriptWebAPI NamedNodeMap NameList Navigator NavigatorGeolocation NavigatorID NavigatorLanguage NavigatorOnLine NavigatorPlugins NetworkInformation Node NodeFilter NodeIterator NodeList Notation Notification NotifyAudioAvailableEvent OfflineAudioCompletionEvent OfflineAudioContext PannerNode ParentNode Performance PerformanceNavigation PerformanceTiming Plugin PluginArray Position PositionError PositionOptions PowerManager ProcessingInstruction ProgressEvent Promise PromiseResolver PushManager
115 syntax keyword javaScriptWebAPI Range ScriptProcessorNode Selection SettingsLock SettingsManager SharedWorker StyleSheet StyleSheetList SVGAElement SVGAngle SVGAnimateColorElement SVGAnimatedAngle SVGAnimatedBoolean SVGAnimatedEnumeration SVGAnimatedInteger SVGAnimatedLengthList SVGAnimatedNumber SVGAnimatedNumberList SVGAnimatedPoints SVGAnimatedPreserveAspectRatio SVGAnimatedRect SVGAnimatedString SVGAnimatedTransformList SVGAnimateElement SVGAnimateMotionElement SVGAnimateTransformElement SVGAnimationElement SVGCircleElement SVGClipPathElement SVGCursorElement SVGDefsElement SVGDescElement SVGElement SVGEllipseElement SVGFilterElement SVGFontElement SVGFontFaceElement SVGFontFaceFormatElement SVGFontFaceNameElement SVGFontFaceSrcElement SVGFontFaceUriElement
116 syntax keyword javaScriptWebAPI SVGForeignObjectElement SVGGElement SVGGlyphElement SVGGradientElement SVGHKernElement SVGImageElement SVGLength SVGLengthList SVGLinearGradientElement SVGLineElement SVGMaskElement SVGMatrix SVGMissingGlyphElement SVGMPathElement SVGNumber SVGNumberList SVGPathElement SVGPatternElement SVGPolygonElement SVGPolylineElement SVGPreserveAspectRatio SVGRadialGradientElement SVGRect SVGRectElement SVGScriptElement SVGSetElement SVGStopElement SVGStringList SVGStylable SVGStyleElement SVGSVGElement SVGSwitchElement SVGSymbolElement SVGTests SVGTextElement SVGTextPositioningElement SVGTitleElement SVGTransform SVGTransformable SVGTransformList SVGTRefElement SVGTSpanElement SVGUseElement SVGViewElement SVGVKernElement TCPSocket Telephony TelephonyCall Text TextDecoder TextEncoder TextMetrics TimeRanges Touch TouchEvent TouchList Transferable TransitionEvent TreeWalker TypeInfo UIEvent Uint16Array Uint32Array Uint8Array Uint8ClampedArray URL URLUtils URLUtilsReadOnly
117 " }}}
118 " DOM2 CONSTANT {{{
119 syntax keyword javaScriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
120 syntax keyword javaScriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
121 "}}}
122 " HTML events and internal variables"{{{
123 syntax case ignore
124 syntax keyword javaScriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize onload onsubmit
125 syntax case match
126 "}}}
127
128 " Follow stuff should be highligh within a special context
129 " While it can't be handled with context depended with Regex based highlight
130 " So, turn it off by default
131 if exists("javascript_enable_domhtmlcss")
132 " DOM2 things {{{
133 syntax match javaScriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
134 syntax match javaScriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=javaScriptParen skipwhite
135 "}}}
136 " HTML things {{{
137 syntax match javaScriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
138 syntax match javaScriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=javaScriptParen skipwhite
139 "}}}
140 " CSS Styles in JavaScript {{{
141 syntax keyword javaScriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
142 syntax keyword javaScriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
143 syntax keyword javaScriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
144 syntax keyword javaScriptCssStyles contained bottom height left position right top width zIndex
145 syntax keyword javaScriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
146 syntax keyword javaScriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
147 syntax keyword javaScriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType
148 syntax keyword javaScriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage gackgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
149 syntax keyword javaScriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
150 syntax keyword javaScriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
151 syntax keyword javaScriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
152 "}}}
153 " Highlight ways {{{
154 syntax match javaScriptDotNotation "\." nextgroup=javaScriptPrototype,javaScriptDomElemAttrs,javaScriptDomElemFuncs,javaScriptHtmlElemAttrs,javaScriptHtmlElemFuncs
155 syntax match javaScriptDotNotation "\.style\." nextgroup=javaScriptCssStyles
156 "}}}
157 endif
158 " end DOM/HTML/CSS specified things }}}
159 " Code blocks"{{{
160 syntax cluster javaScriptAll contains=javaScriptComment,javaScriptLineComment,javaScriptDocComment,javaScriptString,javaScriptRegexpString,javaScriptNumber,javaScriptFloat,javaScriptLabel,javaScriptSource,javaScriptWebAPI,javaScriptOperator,javaScriptBoolean,javaScriptNull,javaScriptFuncKeyword,javaScriptConditional,javaScriptGlobal,javaScriptRepeat,javaScriptBranch,javaScriptStatement,javaScriptGlobalObjects,javaScriptMessage,javaScriptIdentifier,javaScriptExceptions,javaScriptReserved,javaScriptDeprecated,javaScriptDomErrNo,javaScriptDomNodeConsts,javaScriptHtmlEvents,javaScriptDotNotation,javaScriptBrowserObjects,javaScriptDOMObjects,javaScriptAjaxObjects,javaScriptPropietaryObjects,javaScriptDOMMethods,javaScriptHtmlElemProperties,javaScriptDOMProperties,javaScriptEventListenerKeywords,javaScriptEventListenerMethods,javaScriptAjaxProperties,javaScriptAjaxMethods,javaScriptFuncArg
161
162 if main_syntax == "javascript"
163 syntax sync clear
164 syntax sync ccomment javaScriptComment minlines=200
165 " syntax sync match javaScriptHighlight grouphere javaScriptBlock /{/
166 endif
167 "}}}
168 " Function and arguments highlighting {{{
169 syntax keyword javaScriptFuncKeyword function contained
170 syntax region javaScriptFuncExp start=/\w\+\s\==\s\=function\>/ end="\([^)]*\)" contains=javaScriptFuncEq,javaScriptFuncKeyword,javaScriptFuncArg keepend
171 syntax match javaScriptFuncArg "\(([^()]*)\)" contains=javaScriptParens,javaScriptFuncComma contained
172 syntax match javaScriptFuncComma /,/ contained
173 syntax match javaScriptFuncEq /=/ contained
174 syntax region javaScriptFuncDef start="\<function\>" end="\([^)]*\)" contains=javaScriptFuncKeyword,javaScriptFuncArg keepend
175 syntax match javaScriptObjectKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=javaScriptFunctionKey
176 syntax match javaScriptFunctionKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/ contained
177 "}}}
178 " Braces, Parens, symbols, colons {{{
179 syntax match javaScriptBraces "[{}\[\]]"
180 syntax match javaScriptParens "[()]"
181 syntax match javaScriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
182 syntax match javaScriptEndColons "[;,]"
183 syntax match javaScriptLogicSymbols "\(&&\)\|\(||\)"
184 "}}}
185 " ES6 String Interpolation {{{
186 syntax match javaScriptTemplateDelim "\${\|}" contained
187 syntax region javaScriptTemplateVar start=+${+ end=+}+ contains=javaScriptTemplateDelim keepend
188 syntax region javaScriptTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=javaScriptTemplateVar,javaScriptSpecial keepend
189 "}}}
190 " JavaScriptFold Function {{{
191
192 function! JavaScriptFold()
193 setl foldmethod=syntax
194 setl foldlevelstart=1
195 syntax region foldBraces start=/{/ end=/}/ transparent fold keepend extend
196 endfunction
197
198 " }}}
199 " Highlight links {{{
200 " Define the default highlighting.
201 " For version 5.7 and earlier: only when not done already
202 " For version 5.8 and later: only when an item doesn't have highlighting yet
203 if version >= 508 || !exists("did_javascript_syn_inits")
204 if version < 508
205 let did_javascript_syn_inits = 1
206 command -nargs=+ HiLink hi link <args>
207 else
208 command -nargs=+ HiLink hi def link <args>
209 endif
210 HiLink javaScriptEndColons Operator
211 HiLink javaScriptOpSymbols Operator
212 HiLink javaScriptLogicSymbols Boolean
213 HiLink javaScriptBraces Function
214 HiLink javaScriptParens Operator
215 HiLink javaScriptTemplateDelim Operator
216
217 HiLink javaScriptComment Comment
218 HiLink javaScriptLineComment Comment
219 HiLink javaScriptDocComment Comment
220 HiLink javaScriptCommentTodo Todo
221
222 HiLink javaScriptDocTags Special
223 HiLink javaScriptDocSeeTag Function
224 HiLink javaScriptDocParam Function
225
226 HiLink javaScriptString String
227 HiLink javaScriptRegexpString String
228 HiLink javaScriptTemplateString String
229
230 HiLink javaScriptNumber Number
231 HiLink javaScriptFloat Number
232
233 HiLink javaScriptGlobal Constant
234 HiLink javaScriptCharacter Character
235 HiLink javaScriptPrototype Type
236 HiLink javaScriptConditional Conditional
237 HiLink javaScriptBranch Conditional
238 HiLink javaScriptIdentifier Identifier
239 HiLink javaScriptRepeat Repeat
240 HiLink javaScriptStatement Statement
241 HiLink javaScriptMessage Keyword
242 HiLink javaScriptReserved Keyword
243 HiLink javaScriptOperator Operator
244 HiLink javaScriptNull Type
245 HiLink javaScriptBoolean Boolean
246 HiLink javaScriptLabel Label
247 HiLink javaScriptSpecial Special
248 HiLink javaScriptSource Special
249 HiLink javaScriptGlobalObjects Special
250 HiLink javaScriptExceptions Special
251
252 HiLink javaScriptDeprecated Exception
253 HiLink javaScriptError Error
254 HiLink javaScriptParensError Error
255 HiLink javaScriptParensErrA Error
256 HiLink javaScriptParensErrB Error
257 HiLink javaScriptParensErrC Error
258 HiLink javaScriptDomErrNo Error
259
260 HiLink javaScriptDomNodeConsts Constant
261 HiLink javaScriptDomElemAttrs Label
262 HiLink javaScriptDomElemFuncs Type
263
264 HiLink javaScriptWebAPI Type
265
266 HiLink javaScriptHtmlElemAttrs Label
267 HiLink javaScriptHtmlElemFuncs Type
268
269 HiLink javaScriptCssStyles Type
270
271 HiLink javaScriptBrowserObjects Constant
272
273 HiLink javaScriptDOMObjects Constant
274 HiLink javaScriptDOMMethods Type
275 HiLink javaScriptDOMProperties Label
276
277 HiLink javaScriptAjaxObjects Constant
278 HiLink javaScriptAjaxMethods Type
279 HiLink javaScriptAjaxProperties Label
280
281 HiLink javaScriptFuncKeyword Function
282 HiLink javaScriptFuncDef PreProc
283 HiLink javaScriptFuncExp Title
284 HiLink javaScriptFuncArg Special
285 HiLink javaScriptFuncComma Operator
286 HiLink javaScriptFuncEq Operator
287
288 HiLink javaScriptHtmlEvents Constant
289 HiLink javaScriptHtmlElemProperties Label
290
291 HiLink javaScriptEventListenerKeywords Type
292
293 HiLink javaScriptPropietaryObjects Constant
294
295 delcommand HiLink
296 endif
297 " end Highlight links }}}
298
299 " Define the htmlJavaScript for HTML syntax html.vim
300 "syntax clear htmlJavaScript
301 "syntax clear javaScriptExpression
302 syntax cluster htmlJavaScript contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError
303 syntax cluster javaScriptExpression contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError,@htmlPreproc
304
305 let b:current_syntax = "javascript"
306 if main_syntax == 'javascript'
307 unlet main_syntax
308 endif
309 syntax region jsInJsdocExample matchgroup=Snip start="^\s*\* @example" end="\(^\s*\* [^[:space:]]\)\@=" containedin=@javaScriptComment contains=@javaScriptAll
310 hi link Snip SpecialComment