Module 719055

8,020 characters · in no known chunk
Dependencies
Required by (1)
Lazily required by (0)none
Requires (0)none
Lazily requires (0)none
Source Raw
function(e){function t(e){return e?"string"==typeof e?e:e.source:null}function n(e){return r("(?=",e,")")}function r(...e){return e.map(e=>t(e)).join("")}function i(e){let t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function s(...e){return"("+(i(e).capture?"":"?:")+e.map(e=>t(e)).join("|")+")"}let a=e=>r(/\b/,e,/\w$/.test(e)?/\b/:/\B/),o=["Protocol","Type"].map(a),l=["init","self"].map(a),u=["Any","Self"],c=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],d=["false","nil","true"],_=["assignment","associativity","higherThan","left","lowerThan","none","right"],f=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],p=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],h=s(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),m=s(h,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),E=r(h,m,"*"),g=s(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),A=s(g,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),I=r(g,A,"*"),T=r(/[A-Z]/,A,"*"),S=["attached","autoclosure",r(/convention\(/,s("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",r(/objc\(/,I,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],y=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];e.exports=function(e){let t={match:/\s+/,relevance:0},i=e.COMMENT("/\\*","\\*/",{contains:["self"]}),h=[e.C_LINE_COMMENT_MODE,i],g={match:[/\./,s(...o,...l)],className:{2:"keyword"}},v={match:r(/\./,s(...c)),relevance:0},N=c.filter(e=>"string"==typeof e).concat(["_|0"]),C={variants:[{className:"keyword",match:s(...c.filter(e=>"string"!=typeof e).concat(u).map(a),...l)}]},R={$pattern:s(/\b\w+/,/#\w+/),keyword:N.concat(f),literal:d},O=[g,v,C],b=[{match:r(/\./,s(...p)),relevance:0},{className:"built_in",match:r(/\b/,s(...p),/(?=\()/)}],D={match:/->/,relevance:0},L=[D,{className:"operator",relevance:0,variants:[{match:E},{match:`\\.(\\.|${m})+`}]}],w="([0-9]_*)+",M="([0-9a-fA-F]_*)+",P={className:"number",relevance:0,variants:[{match:`\\b(${w})(\\.(${w}))?([eE][+-]?(${w}))?\\b`},{match:`\\b0x(${M})(\\.(${M}))?([pP][+-]?(${w}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},x=(e="")=>({className:"subst",variants:[{match:r(/\\/,e,/[0\\tnr"']/)},{match:r(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(e="")=>({className:"subst",match:r(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),U=(e="")=>({className:"subst",label:"interpol",begin:r(/\\/,e,/\(/),end:/\)/}),G=(e="")=>({begin:r(e,/"""/),end:r(/"""/,e),contains:[x(e),k(e),U(e)]}),F=(e="")=>({begin:r(e,/"/),end:r(/"/,e),contains:[x(e),U(e)]}),V={className:"string",variants:[G(),G("#"),G("##"),G("###"),F(),F("#"),F("##"),F("###")]},B=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],H={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:B},j=e=>{let t=r(e,/\//),n=r(/\//,e);return{begin:t,end:n,contains:[...B,{scope:"comment",begin:`#(?!.*${n})`,end:/$/}]}},Y={scope:"regexp",variants:[j("###"),j("##"),j("#"),H]},W={match:r(/`/,I,/`/)},K=[W,{className:"variable",match:/\$\d+/},{className:"variable",match:`\\$${A}+`}],$=[{match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:y,contains:[...L,P,V]}]}},{scope:"keyword",match:r(/@/,s(...S),n(s(/\(/,/\s+/)))},{scope:"meta",match:r(/@/,I)}],z={match:n(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:r(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,A,"+")},{className:"type",match:T,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:r(/\s+&\s+/,n(T)),relevance:0}]},q={begin:/</,end:/>/,keywords:R,contains:[...h,...O,...$,D,z]};z.contains.push(q);let Z={begin:/\(/,end:/\)/,relevance:0,keywords:R,contains:["self",{match:r(I,/\s*:/),keywords:"_|0",relevance:0},...h,Y,...O,...b,...L,P,V,...K,...$,z]},X={begin:/</,end:/>/,keywords:"repeat each",contains:[...h,z]},Q={begin:/\(/,end:/\)/,keywords:R,contains:[{begin:s(n(r(I,/\s*:/)),n(r(I,/\s+/,I,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:I}]},...h,...O,...L,P,V,...$,z,Z],endsParent:!0,illegal:/["']/},J={match:[/(func|macro)/,/\s+/,s(W.match,I,E)],className:{1:"keyword",3:"title.function"},contains:[X,Q,t],illegal:[/\[/,/%/]},ee={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[X,Q,t],illegal:/\[|%/},et={match:[/operator/,/\s+/,E],className:{1:"keyword",3:"title"}},en={begin:[/precedencegroup/,/\s+/,T],className:{1:"keyword",3:"title"},contains:[z],keywords:[..._,...d],end:/}/},er={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ei={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},es={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,I,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:R,contains:[X,...O,{begin:/:/,end:/\{/,keywords:R,contains:[{scope:"title.class.inherited",match:T},...O],relevance:0}]};for(let e of V.variants){let t=e.contains.find(e=>"interpol"===e.label);t.keywords=R;let n=[...O,...b,...L,P,V,...K];t.contains=[...n,{begin:/\(/,end:/\)/,contains:["self",...n]}]}return{name:"Swift",keywords:R,contains:[...h,J,ee,er,ei,es,et,en,{beginKeywords:"import",end:/$/,contains:[...h],relevance:0},Y,...O,...b,...L,P,V,...K,...$,z,Z]}}}