diff --git a/syntaxes/fjsx15/web.sublime-syntax b/syntaxes/fjsx15/web.sublime-syntax index b0ae4ece..5c281a3a 100644 --- a/syntaxes/fjsx15/web.sublime-syntax +++ b/syntaxes/fjsx15/web.sublime-syntax @@ -17,235 +17,448 @@ hidden: true scope: ... -contexts: - main: - - include: document-functions - - include: document-properties - - include: window-functions +variables: + documentFunctions: | + (?> adoptNode + | close + | create + # createAttribute + (?> Attribute + # createCDATASection + | CDATASection + # createComment + | Comment + # createDocumentFragment + | DocumentFragment + # ccreateElement, reateElementNS + | Element(?:NS)? + # createExpression + | Event + # createExpression + | Expression + # createNodeIterator + | NodeIterator + # createNSResolver + | NSResolver + # createProcessingInstruction + | ProcessingInstruction + # createRange + | Range + # createTextNode + | TextNode + # createTreeWalker + | TreeWalker + ) + | elementFromPoint + | enableStyleSheetsForSet + | evaluate + | execCommand + | exitFullscreen + | getElement + # getElementById + (?> ById + | sBy + # getElementsByClassName + (?> ClassName + # getElementsByName + | Name + # getElementsByTagName, getElementsByTagNameNS + | TagName(?:NS)? + ) + ) + | getSelection + | hasFocus + | importNode + | open + | query + # queryCommand, queryCommandEnabled, queryCommandSupported + (?> Command(?>Enabled|Supported) + # querySelector, querySelectorAll + | Selector(?:All)? + ) + | releaseCapture + # write, writeln + | write(?:ln)? + )\b - document-functions: - - match: | - (?x) - (document)\b - (?: - \s*(\.)\s* - ((?> adoptNode - | close - | create - (?> Attribute - | CDATASection - | Comment - | DocumentFragment - | Element(?:NS)? - | Event - | Expression - | NodeIterator - | NSResolver - | ProcessingInstruction - | Range - | TextNode - | TreeWalker - ) - | elementFromPoint - | enableStyleSheetsForSet - | evaluate - | execCommand - | exitFullscreen - | getElement - (?> ById - | sBy - (?> ClassName - | Name - | TagName(?:NS)? - ) - ) - | getSelection - | hasFocus - | importNode - | open - | query - (?> Command(?>Enabled|Supported) - | Selector(?:All)? - ) - | releaseCapture - | write(?:ln)? - ))\b + windowFunctions: | + (?> addEventListener + | alert + | atob + | blur + | btoa + # cancelAnimationFrame, cancelIddleCallback + | cancel(?>AnimationFrame|IdleCallback) + # clearInterval, clearTimeout + | clear(?>Interval|Timeout) + | close + | confirm + | convertPointFromNodeToPage + | createImageBitmap + | event + | fetch + | focus + | forward + | get + # getAttention + (?> Attention + # getComputedStyle + | ComputedStyle + # getDefaultComputedStyle + | DefaultComputedStyle + # getSelection + | Selection ) + | home + | matchMedia + | minimize + # moveBy, moveTo + | move(?>By|To) + | open + | postMessage + | print + | prompt + # requestAnimationFrame, requestIdleCallback + | request(?>AnimationFrame|IdleCallback) + | removeEventListener + # resizeBy, resizeTo + | resize(?>By|To) + | restore + | routeEvent + | scroll + # scrollBy, scrollByPages + (?> By(?:Pages)? + # ScrollTo + | To + )? + # setInterval, setTimeout + | set(?>Interval|Timeout) + | sizeToContent + | stop + | updateCommands + )\b + +contexts: + main: + # Document property or function. + - match: (document)\s*(\.) captures: 1: support.type.object.dom.js.fjsx15 2: punctuation.accessor.js.fjsx15 - 3: support.function.js.fjsx15 - set: optional-generic-and-arguments - - document-properties: - - match: | - (?x) - (document)\b - (?: - \s*(\.)\s* - ((?> activeElement - | body - | characterSet - | childElementCount - | children - | compatMode - | currentScript - | defaultView - | designMode - | dir - | doctype - | documentElement - | documentURI - | documentURIObject - | domain - | embeds - | firstElementChild - | forms - | fullscreenElement - | fullscreenEnabled - | head - | hidden - | images - | implementation - | last - (?> ElementChild - | Modified - | StyleSheetSet - ) - | links - | location - | on - (?> abort - | animationcancel - | animationend - | blur - | change - | click - | close - | contextmenu - | dblclick - | error - | focus - | fullscreenchange - | fullscreenerror - | gotpointercapture - | input - | keydown - | keypress - | keyup - | load - | loadend - | loadstart - | lostpointercapture - | mousedown - | mousemove - | mouseout - | mouseover - | mouseup - | offline - | online - | pointercancel - | pointerdown - | pointerenter - | pointerleave - | pointermove - | pointerout - | pointerover - | pointerup - | reset - | resize - | scroll - | select - | submit - | transitioncancel - | transitionend - | visibilitychange - | wheel - ) - | plugins - | pointerLockElement - | popupNode - | preferredStyleSheetSet - | readyState - | referrer - | scripts - | scrollingElement - | selectedStyleSheetSet - | styleSheets - | styleSheetSets - | title - | tooltipNode - | URL - | visibilityState - ))\b - ) + set: document-property-or-function + # Window property or function. + - match: (window)\s*(\.) captures: 1: support.type.object.dom.js.fjsx15 2: punctuation.accessor.js.fjsx15 - 3: support.variable.js.fjsx15 + set: window-property-or-function + # Just the global objects. + - match: (?>document|window)\b + scope: support.type.object.dom.js.fjsx15 pop: true + arguments: + - include: Packages/Naomi/syntaxes/fjsx15/function-call/arguments.sublime-syntax + + document-property-or-function: + # Function call. + - match: (?x){{documentFunctions}}(?=\s*\() + scope: support.function.js.fjsx15 + set: [ + function-call-meta-scope, + arguments + ] + # Function reference. + - match: (?x){{documentFunctions}} + scope: support.function.js.fjsx15 + pop: true + # Properties. + - match: | + (?x) + (?> activeElement + | body + | characterSet + | childElementCount + | children + | compatMode + | currentScript + | defaultView + | designMode + | dir + | doctype + | documentElement + | documentURI + | documentURIObject + | domain + | embeds + | firstElementChild + | forms + | fullscreenElement + | fullscreenEnabled + | head + | hidden + | images + | implementation + | last + (?> ElementChild + | Modified + | StyleSheetSet + ) + | links + | location + | on + (?> abort + | animationcancel + | animationend + | blur + | change + | click + | close + | contextmenu + | dblclick + | error + | focus + | fullscreenchange + | fullscreenerror + | gotpointercapture + | input + | keydown + | keypress + | keyup + | load + | loadend + | loadstart + | lostpointercapture + | mousedown + | mousemove + | mouseout + | mouseover + | mouseup + | offline + | online + | pointercancel + | pointerdown + | pointerenter + | pointerleave + | pointermove + | pointerout + | pointerover + | pointerup + | reset + | resize + | scroll + | select + | submit + | transitioncancel + | transitionend + | visibilitychange + | wheel + ) + | plugins + | pointerLockElement + | popupNode + | preferredStyleSheetSet + | readyState + | referrer + | scripts + | scrollingElement + | selectedStyleSheetSet + | styleSheets + | styleSheetSets + | title + | tooltipNode + | URL + | visibilityState + )\b + scope: support.variable.js.fjsx15 + pop: true + # Bail. + - include: else-pop + else-pop: - match: (?=\S) pop: true - optional-generic-and-arguments: - - include: Packages/Naomi/syntaxes/flow1/generic/arguments.no-pop.sublime-syntax - - include: Packages/Naomi/syntaxes/fjsx15/expression.sublime-syntax - - include: else-pop + function-call-meta-scope: + - meta_scope: meta.function-call.js.fjsx15 + - include: pop-now + + pop-now: + - match: "" + pop: true - window-functions: + window-property-or-function: + # Function call. + - match: (?x){{windowFunctions}}(?=\s*\() + scope: support.function.js.fjsx15 + set: [ + function-call-meta-scope, + arguments + ] + # Function reference. + - match: (?x){{windowFunctions}} + scope: support.function.js.fjsx15 + pop: true + # Properties. - match: | (?x) - (window)\b - (?: - \s*(\.)\s* - ((?> addEventListener - | alert - | atob - | blur - | btoa - | cancel(?>AnimationFrame|IdleCallback) - | clear(?>Interval|Timeout) - | close - | confirm - | convertPointFromNodeToPage - | createImageBitmap - | event - | fetch - | focus - | forward - | get - (?> Attention - | ComputedStyle - | DefaultComputedStyle - | Selection - ) - | home - | matchMedia - | minimize - | move(?>By|To) - | open - | postMessage - | print - | prompt - | request(?>AnimationFrame|IdleCallback) - | removeEventListener - | resize(?>By|To) - | restore - | routeEvent - | scroll - (?> By(?:Pages)? - | To - )? - | set(?>Interval|Timeout) - | sizeToContent - | stop - | updateCommands - ))\b - ) - captures: - 1: support.type.object.dom.js.fjsx15 - 2: punctuation.accessor.js.fjsx15 - 3: support.function.js.fjsx15 - set: optional-generic-and-arguments + (?> applicationCache + | caches + | closed + | console + | controllers + | crypto + | devicePixelRatio + | document + | frameElement + | frames + | fullScreen + | history + | indexedDB + # innerHeight, innerWidth + | inner(?>Height|Width) + | isSecureContext + | length + | localStorage + # location, locationbar + | location(?:bar)? + | menubar + | messageManager + | name + | navigator + | onabort + | onafterprint + | onanimation + # onanimationcancel + (?> cancel + # onanimationend + | end + # onanimationiteration + | iteration + ) + | onappinstalled + | onauxclick + | onbefore + # onbeforeinstallprompt + (?> installprompt + # onbeforeprint + | print + # onbeforeunload + | unload + ) + | onblur + | onchange + | onclick + | onclose + | oncontextmenu + | ondblclick + | ondevice + # ondevicelight + (?> light + # ondevicemotion + | motion + # ondeviceorientation + | orientation + # ondeviceorientationabsolute + | orientationabsolute + # ondevice$roximity + | proximity + ) + | onerror + | onfocus + # ongamepadconnected, ongamepaddisconnected + | ongamepad(?>connected|disconnected) + | ongotpointercapture + | onhashchange + | oninput + # onkeydown, onkeypress, onkeyup + | onkey(?>down|press|up) + | onlanguagechange + # onload, onloadend, onloadstart + | onload(?>end|start)? + | onlostpointercapture + | onmessage + | onmessageerror + # onmousedown, onmousemove, onmouseout, onmouseover, onmouseup + | onmouse(?>down|move|out|over|up) + | onpointer + # onpointercancel + (?> cancel + # onpointerenter + | enter + # onpointerleave + | leave + # onpointermove + | move + # onpointerout + | out + # onpointerover + | over + # onpointerup + | up + ) + | onpopstate + | onrejectionhandled + | onreset + | onresize + | onscroll + | onselect + | onselectionchange + | onselectstart + | onstorage + | onsubmit + # ontouchcancel, ontouchmove, ontouchstart + | ontouch(?>cancel|move|start) + # ontransitioncancel, ontransitionend + | ontransition(?>cancel|end) + | onunhandledrejection + | onunload + | onuserproximity + | onvrdisplay + # onvrdisplayactivate + (?> activate + # onvrdisplayblur + | blur + # onvrdisplayconnect + | connect + # onvrdisplaydeactivate + | deactivate + # onvrdisplaydisconnect + | disconnect + # onvrdisplayfocus + | focus + # onvrdisplaypresentchange + | presentchange + ) + | onwheel + | opener + | origin + # outerHeight, outerWidth + | outer(?>Height|Width) + | pageYOffset + | parent + | performance + | personalbar + # screen, screenX, screenY + | screen[XY]? + | scroll + # scrollbars + (?> bars + # scrollX, scrollY + | [XY] + ) + | self + | sessionStorage + | speechSynthesis + # status, statusbar + | status(?:bar)? + | toolbar + | top + | URL + | visualViewport + | window + )\b + scope: support.variable.js.fjsx15 + pop: true + # Bail. + - include: else-pop