mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-12 09:09:45 +01:00
1 line
28 KiB
Plaintext
1 line
28 KiB
Plaintext
{"version":3,"file":"7551.6e574d5a75cf073215df.js","mappings":"sFASA,SAASA,EAAOC,GACd,OAAKA,EACa,iBAAPA,EAAwBA,EAE5BA,EAAGD,OAHM,KAUlB,SAASE,EAAUD,GACjB,OAAOE,EAAO,MAAOF,EAAI,KAO3B,SAASE,KAAUC,GAEjB,OADeA,EAAKC,KAAKC,GAAMN,EAAOM,KAAIC,KAAK,IA4BjD,SAASC,KAAUJ,GAEjB,MAAMK,EAtBR,SAA8BL,GAC5B,MAAMK,EAAOL,EAAKA,EAAKM,OAAS,GAEhC,MAAoB,iBAATD,GAAqBA,EAAKE,cAAgBC,QACnDR,EAAKS,OAAOT,EAAKM,OAAS,EAAG,GACtBD,GAEA,GAeIK,CAAqBV,GAIlC,MAHe,KACVK,EAAKM,QAAU,GAAK,MACrBX,EAAKC,KAAKC,GAAMN,EAAOM,KAAIC,KAAK,KAAO,IAI7C,MAAMS,EAAiBC,GAAWd,EAChC,KACAc,EACA,MAAMC,KAAKD,GAAW,KAAO,MAIzBE,EAAc,CAClB,WACA,QACAd,IAAIW,GAGAI,EAAsB,CAC1B,OACA,QACAf,IAAIW,GAGAK,EAAe,CACnB,MACA,QAIIC,EAAW,CAIf,QACA,iBACA,QACA,QACA,OACA,MACA,KACA,QACA,OACA,QACA,QACA,WACA,cACA,UACA,QACA,SACA,SACA,KACA,UACA,OACA,OACA,YACA,cACA,qBACA,cACA,QACA,MACA,OACA,MACA,QACA,KACA,SACA,WACA,QACA,SACA,QACA,QACA,kBACA,WACA,KACA,KACA,WACA,cACA,OACA,MACA,WACA,cACA,cACA,OACA,WACA,WACA,WACA,UACA,kBACA,SACA,iBACA,UACA,WACA,gBACA,SACA,SACA,WACA,WACA,SACA,MACA,OACA,SACA,SACA,YACA,QACA,SACA,SACA,QACA,QACA,OACA,MACA,YACA,kBACA,oBACA,UACA,MACA,OACA,QACA,QACA,WAOIC,EAAW,CACf,QACA,MACA,QAIIC,EAA0B,CAC9B,aACA,gBACA,aACA,OACA,YACA,OACA,SAKIC,EAAqB,CACzB,gBACA,UACA,aACA,QACA,UACA,SACA,SACA,QACA,UACA,eACA,YACA,YACA,MACA,gBACA,WACA,QACA,YACA,kBACA,2BACA,YAIIC,EAAW,CACf,MACA,MACA,MACA,SACA,mBACA,aACA,OACA,aACA,YACA,4BACA,MACA,MACA,cACA,eACA,eACA,eACA,sBACA,QACA,WACA,gBACA,WACA,SACA,OACA,oCACA,YACA,OACA,gBACA,iBACA,uBACA,2BACA,oBACA,aACA,0BACA,OAIIC,EAAenB,EACnB,oBACA,kBACA,iBACA,iBACA,iBACA,mCACA,kBACA,kBACA,kBACA,kBACA,kBACA,kBACA,kBACA,kBACA,kBACA,kBACA,kBACA,YAIIoB,EAAoBpB,EACxBmB,EACA,kBACA,kBACA,kBACA,kBACA,mBAMIE,EAAW1B,EAAOwB,EAAcC,EAAmB,KAGnDE,EAAiBtB,EACrB,YACA,uDACA,yDACA,yDACA,kBACA,+DACA,yDACA,+BACA,yDACA,yDACA,gCASIuB,EAAsBvB,EAC1BsB,EACA,KACA,0DAIIE,EAAa7B,EAAO2B,EAAgBC,EAAqB,KAGzDE,EAAiB9B,EAAO,QAAS4B,EAAqB,KAItDG,EAAoB,CACxB,cACA/B,EAAO,eAAgBK,EAAO,QAAS,QAAS,KAAM,MACtD,oBACA,kBACA,sBACA,WACA,SACA,gBACA,WACA,eACA,gBACA,WACA,gBACA,YACA,OACA,UACA,oBACA,YACA,YACAL,EAAO,SAAU6B,EAAY,MAC7B,OACA,cACA,kBACA,iCACA,gBACA,WACA,oBACA,UACA,oBAIIG,EAAuB,CAC3B,MACA,0BACA,QACA,4BACA,cACA,kCACA,UACA,8BACA,OACA,2BACA,SA2dFC,EAAOC,QA9cP,SAAeC,GACb,MAAMC,EAAa,CACjBC,MAAO,MACPC,UAAW,GAGPC,EAAgBJ,EAAKK,QAC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IACLE,KACAD,GAEL+C,IAAK,KAIP,IAAK,MAAMoB,KAAWjB,EAAOnB,SAAU,CACrC,MAAMqC,EAAgBD,EAAQ9C,SAASgD,MAAKC,GAAuB,aAAfA,EAAKzB,QAEzDuB,EAAcrE,SAAWiC,EACzB,MAAMuC,EAAW,IACZpC,KACAC,KACAE,EACHE,EACAU,KACGE,GAELgB,EAAc/C,SAAW,IACpBkD,EACH,CACEzB,MAAO,KACPC,IAAK,KACL1B,SAAU,CACR,UACGkD,KAMX,MAAO,CACLC,KAAM,QACNzE,SAAUiC,EACVX,SAAU,IACLC,EACHyC,EACAC,EACA,CACES,cAAe,6CACf1B,IAAK,MACL2B,YAAY,EACZ3E,SAAUiC,EACVX,SAAU,CACRN,EAAK4D,QAAQ5D,EAAK6D,WAAY,CAC5BnD,UAAW,cACXqB,MAAO,6CAENX,IAGP8B,EACAC,EACA,CACEO,cAAe,SACf1B,IAAK,IACL1B,SAAU,IAAKC,GACfJ,UAAW,MAEViB,KACAC,KACAE,EACHE,EACAU,KACGE,KACAC,EACHE,EACAG","sources":["webpack://telegram-t/./node_modules/highlight.js/lib/languages/swift.js"],"sourcesContent":["/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array<string | RegExp | Object> } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\nconst keywordWrapper = keyword => concat(\n /\\b/,\n keyword,\n /\\w$/.test(keyword) ? /\\b/ : /\\B/\n);\n\n// Keywords that require a leading dot.\nconst dotKeywords = [\n 'Protocol', // contextual\n 'Type' // contextual\n].map(keywordWrapper);\n\n// Keywords that may have a leading dot.\nconst optionalDotKeywords = [\n 'init',\n 'self'\n].map(keywordWrapper);\n\n// should register as keyword, not type\nconst keywordTypes = [\n 'Any',\n 'Self'\n];\n\n// Regular keywords and literals.\nconst keywords = [\n // strings below will be fed into the regular `keywords` engine while regex\n // will result in additional modes being created to scan for those keywords to\n // avoid conflicts with other rules\n 'actor',\n 'associatedtype',\n 'async',\n 'await',\n /as\\?/, // operator\n /as!/, // operator\n 'as', // operator\n 'break',\n 'case',\n 'catch',\n 'class',\n 'continue',\n 'convenience', // contextual\n 'default',\n 'defer',\n 'deinit',\n 'didSet', // contextual\n 'do',\n 'dynamic', // contextual\n 'else',\n 'enum',\n 'extension',\n 'fallthrough',\n /fileprivate\\(set\\)/,\n 'fileprivate',\n 'final', // contextual\n 'for',\n 'func',\n 'get', // contextual\n 'guard',\n 'if',\n 'import',\n 'indirect', // contextual\n 'infix', // contextual\n /init\\?/,\n /init!/,\n 'inout',\n /internal\\(set\\)/,\n 'internal',\n 'in',\n 'is', // operator\n 'isolated', // contextual\n 'nonisolated', // contextual\n 'lazy', // contextual\n 'let',\n 'mutating', // contextual\n 'nonmutating', // contextual\n /open\\(set\\)/, // contextual\n 'open', // contextual\n 'operator',\n 'optional', // contextual\n 'override', // contextual\n 'postfix', // contextual\n 'precedencegroup',\n 'prefix', // contextual\n /private\\(set\\)/,\n 'private',\n 'protocol',\n /public\\(set\\)/,\n 'public',\n 'repeat',\n 'required', // contextual\n 'rethrows',\n 'return',\n 'set', // contextual\n 'some', // contextual\n 'static',\n 'struct',\n 'subscript',\n 'super',\n 'switch',\n 'throws',\n 'throw',\n /try\\?/, // operator\n /try!/, // operator\n 'try', // operator\n 'typealias',\n /unowned\\(safe\\)/, // contextual\n /unowned\\(unsafe\\)/, // contextual\n 'unowned', // contextual\n 'var',\n 'weak', // contextual\n 'where',\n 'while',\n 'willSet' // contextual\n];\n\n// NOTE: Contextual keywords are reserved only in specific contexts.\n// Ideally, these should be matched using modes to avoid false positives.\n\n// Literals.\nconst literals = [\n 'false',\n 'nil',\n 'true'\n];\n\n// Keywords used in precedence groups.\nconst precedencegroupKeywords = [\n 'assignment',\n 'associativity',\n 'higherThan',\n 'left',\n 'lowerThan',\n 'none',\n 'right'\n];\n\n// Keywords that start with a number sign (#).\n// #(un)available is handled separately.\nconst numberSignKeywords = [\n '#colorLiteral',\n '#column',\n '#dsohandle',\n '#else',\n '#elseif',\n '#endif',\n '#error',\n '#file',\n '#fileID',\n '#fileLiteral',\n '#filePath',\n '#function',\n '#if',\n '#imageLiteral',\n '#keyPath',\n '#line',\n '#selector',\n '#sourceLocation',\n '#warn_unqualified_access',\n '#warning'\n];\n\n// Global functions in the Standard Library.\nconst builtIns = [\n 'abs',\n 'all',\n 'any',\n 'assert',\n 'assertionFailure',\n 'debugPrint',\n 'dump',\n 'fatalError',\n 'getVaList',\n 'isKnownUniquelyReferenced',\n 'max',\n 'min',\n 'numericCast',\n 'pointwiseMax',\n 'pointwiseMin',\n 'precondition',\n 'preconditionFailure',\n 'print',\n 'readLine',\n 'repeatElement',\n 'sequence',\n 'stride',\n 'swap',\n 'swift_unboxFromSwiftValueWithType',\n 'transcode',\n 'type',\n 'unsafeBitCast',\n 'unsafeDowncast',\n 'withExtendedLifetime',\n 'withUnsafeMutablePointer',\n 'withUnsafePointer',\n 'withVaList',\n 'withoutActuallyEscaping',\n 'zip'\n];\n\n// Valid first characters for operators.\nconst operatorHead = either(\n /[/=\\-+!*%<>&|^~?]/,\n /[\\u00A1-\\u00A7]/,\n /[\\u00A9\\u00AB]/,\n /[\\u00AC\\u00AE]/,\n /[\\u00B0\\u00B1]/,\n /[\\u00B6\\u00BB\\u00BF\\u00D7\\u00F7]/,\n /[\\u2016-\\u2017]/,\n /[\\u2020-\\u2027]/,\n /[\\u2030-\\u203E]/,\n /[\\u2041-\\u2053]/,\n /[\\u2055-\\u205E]/,\n /[\\u2190-\\u23FF]/,\n /[\\u2500-\\u2775]/,\n /[\\u2794-\\u2BFF]/,\n /[\\u2E00-\\u2E7F]/,\n /[\\u3001-\\u3003]/,\n /[\\u3008-\\u3020]/,\n /[\\u3030]/\n);\n\n// Valid characters for operators.\nconst operatorCharacter = either(\n operatorHead,\n /[\\u0300-\\u036F]/,\n /[\\u1DC0-\\u1DFF]/,\n /[\\u20D0-\\u20FF]/,\n /[\\uFE00-\\uFE0F]/,\n /[\\uFE20-\\uFE2F]/\n // TODO: The following characters are also allowed, but the regex isn't supported yet.\n // /[\\u{E0100}-\\u{E01EF}]/u\n);\n\n// Valid operator.\nconst operator = concat(operatorHead, operatorCharacter, '*');\n\n// Valid first characters for identifiers.\nconst identifierHead = either(\n /[a-zA-Z_]/,\n /[\\u00A8\\u00AA\\u00AD\\u00AF\\u00B2-\\u00B5\\u00B7-\\u00BA]/,\n /[\\u00BC-\\u00BE\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u00FF]/,\n /[\\u0100-\\u02FF\\u0370-\\u167F\\u1681-\\u180D\\u180F-\\u1DBF]/,\n /[\\u1E00-\\u1FFF]/,\n /[\\u200B-\\u200D\\u202A-\\u202E\\u203F-\\u2040\\u2054\\u2060-\\u206F]/,\n /[\\u2070-\\u20CF\\u2100-\\u218F\\u2460-\\u24FF\\u2776-\\u2793]/,\n /[\\u2C00-\\u2DFF\\u2E80-\\u2FFF]/,\n /[\\u3004-\\u3007\\u3021-\\u302F\\u3031-\\u303F\\u3040-\\uD7FF]/,\n /[\\uF900-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFE1F\\uFE30-\\uFE44]/,\n /[\\uFE47-\\uFEFE\\uFF00-\\uFFFD]/ // Should be /[\\uFE47-\\uFFFD]/, but we have to exclude FEFF.\n // The following characters are also allowed, but the regexes aren't supported yet.\n // /[\\u{10000}-\\u{1FFFD}\\u{20000-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}]/u,\n // /[\\u{50000}-\\u{5FFFD}\\u{60000-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}]/u,\n // /[\\u{90000}-\\u{9FFFD}\\u{A0000-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}]/u,\n // /[\\u{D0000}-\\u{DFFFD}\\u{E0000-\\u{EFFFD}]/u\n);\n\n// Valid characters for identifiers.\nconst identifierCharacter = either(\n identifierHead,\n /\\d/,\n /[\\u0300-\\u036F\\u1DC0-\\u1DFF\\u20D0-\\u20FF\\uFE20-\\uFE2F]/\n);\n\n// Valid identifier.\nconst identifier = concat(identifierHead, identifierCharacter, '*');\n\n// Valid type identifier.\nconst typeIdentifier = concat(/[A-Z]/, identifierCharacter, '*');\n\n// Built-in attributes, which are highlighted as keywords.\n// @available is handled separately.\nconst keywordAttributes = [\n 'autoclosure',\n concat(/convention\\(/, either('swift', 'block', 'c'), /\\)/),\n 'discardableResult',\n 'dynamicCallable',\n 'dynamicMemberLookup',\n 'escaping',\n 'frozen',\n 'GKInspectable',\n 'IBAction',\n 'IBDesignable',\n 'IBInspectable',\n 'IBOutlet',\n 'IBSegueAction',\n 'inlinable',\n 'main',\n 'nonobjc',\n 'NSApplicationMain',\n 'NSCopying',\n 'NSManaged',\n concat(/objc\\(/, identifier, /\\)/),\n 'objc',\n 'objcMembers',\n 'propertyWrapper',\n 'requires_stored_property_inits',\n 'resultBuilder',\n 'testable',\n 'UIApplicationMain',\n 'unknown',\n 'usableFromInline'\n];\n\n// Contextual keywords used in @available and #(un)available.\nconst availabilityKeywords = [\n 'iOS',\n 'iOSApplicationExtension',\n 'macOS',\n 'macOSApplicationExtension',\n 'macCatalyst',\n 'macCatalystApplicationExtension',\n 'watchOS',\n 'watchOSApplicationExtension',\n 'tvOS',\n 'tvOSApplicationExtension',\n 'swift'\n];\n\n/*\nLanguage: Swift\nDescription: Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.\nAuthor: Steven Van Impe <steven.vanimpe@icloud.com>\nContributors: Chris Eidhof <chris@eidhof.nl>, Nate Cook <natecook@gmail.com>, Alexander Lichter <manniL@gmx.net>, Richard Gibson <gibson042@github>\nWebsite: https://swift.org\nCategory: common, system\n*/\n\n/** @type LanguageFn */\nfunction swift(hljs) {\n const WHITESPACE = {\n match: /\\s+/,\n relevance: 0\n };\n // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID411\n const BLOCK_COMMENT = hljs.COMMENT(\n '/\\\\*',\n '\\\\*/',\n { contains: [ 'self' ] }\n );\n const COMMENTS = [\n hljs.C_LINE_COMMENT_MODE,\n BLOCK_COMMENT\n ];\n\n // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID413\n // https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html\n const DOT_KEYWORD = {\n match: [\n /\\./,\n either(...dotKeywords, ...optionalDotKeywords)\n ],\n className: { 2: \"keyword\" }\n };\n const KEYWORD_GUARD = {\n // Consume .keyword to prevent highlighting properties and methods as keywords.\n match: concat(/\\./, either(...keywords)),\n relevance: 0\n };\n const PLAIN_KEYWORDS = keywords\n .filter(kw => typeof kw === 'string')\n .concat([ \"_|0\" ]); // seems common, so 0 relevance\n const REGEX_KEYWORDS = keywords\n .filter(kw => typeof kw !== 'string') // find regex\n .concat(keywordTypes)\n .map(keywordWrapper);\n const KEYWORD = { variants: [\n {\n className: 'keyword',\n match: either(...REGEX_KEYWORDS, ...optionalDotKeywords)\n }\n ] };\n // find all the regular keywords\n const KEYWORDS = {\n $pattern: either(\n /\\b\\w+/, // regular keywords\n /#\\w+/ // number keywords\n ),\n keyword: PLAIN_KEYWORDS\n .concat(numberSignKeywords),\n literal: literals\n };\n const KEYWORD_MODES = [\n DOT_KEYWORD,\n KEYWORD_GUARD,\n KEYWORD\n ];\n\n // https://github.com/apple/swift/tree/main/stdlib/public/core\n const BUILT_IN_GUARD = {\n // Consume .built_in to prevent highlighting properties and methods.\n match: concat(/\\./, either(...builtIns)),\n relevance: 0\n };\n const BUILT_IN = {\n className: 'built_in',\n match: concat(/\\b/, either(...builtIns), /(?=\\()/)\n };\n const BUILT_INS = [\n BUILT_IN_GUARD,\n BUILT_IN\n ];\n\n // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID418\n const OPERATOR_GUARD = {\n // Prevent -> from being highlighting as an operator.\n match: /->/,\n relevance: 0\n };\n const OPERATOR = {\n className: 'operator',\n relevance: 0,\n variants: [\n { match: operator },\n {\n // dot-operator: only operators that start with a dot are allowed to use dots as\n // characters (..., ...<, .*, etc). So there rule here is: a dot followed by one or more\n // characters that may also include dots.\n match: `\\\\.(\\\\.|${operatorCharacter})+` }\n ]\n };\n const OPERATORS = [\n OPERATOR_GUARD,\n OPERATOR\n ];\n\n // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#grammar_numeric-literal\n // TODO: Update for leading `-` after lookbehind is supported everywhere\n const decimalDigits = '([0-9]_*)+';\n const hexDigits = '([0-9a-fA-F]_*)+';\n const NUMBER = {\n className: 'number',\n relevance: 0,\n variants: [\n // decimal floating-point-literal (subsumes decimal-literal)\n { match: `\\\\b(${decimalDigits})(\\\\.(${decimalDigits}))?` + `([eE][+-]?(${decimalDigits}))?\\\\b` },\n // hexadecimal floating-point-literal (subsumes hexadecimal-literal)\n { match: `\\\\b0x(${hexDigits})(\\\\.(${hexDigits}))?` + `([pP][+-]?(${decimalDigits}))?\\\\b` },\n // octal-literal\n { match: /\\b0o([0-7]_*)+\\b/ },\n // binary-literal\n { match: /\\b0b([01]_*)+\\b/ }\n ]\n };\n\n // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#grammar_string-literal\n const ESCAPED_CHARACTER = (rawDelimiter = \"\") => ({\n className: 'subst',\n variants: [\n { match: concat(/\\\\/, rawDelimiter, /[0\\\\tnr\"']/) },\n { match: concat(/\\\\/, rawDelimiter, /u\\{[0-9a-fA-F]{1,8}\\}/) }\n ]\n });\n const ESCAPED_NEWLINE = (rawDelimiter = \"\") => ({\n className: 'subst',\n match: concat(/\\\\/, rawDelimiter, /[\\t ]*(?:[\\r\\n]|\\r\\n)/)\n });\n const INTERPOLATION = (rawDelimiter = \"\") => ({\n className: 'subst',\n label: \"interpol\",\n begin: concat(/\\\\/, rawDelimiter, /\\(/),\n end: /\\)/\n });\n const MULTILINE_STRING = (rawDelimiter = \"\") => ({\n begin: concat(rawDelimiter, /\"\"\"/),\n end: concat(/\"\"\"/, rawDelimiter),\n contains: [\n ESCAPED_CHARACTER(rawDelimiter),\n ESCAPED_NEWLINE(rawDelimiter),\n INTERPOLATION(rawDelimiter)\n ]\n });\n const SINGLE_LINE_STRING = (rawDelimiter = \"\") => ({\n begin: concat(rawDelimiter, /\"/),\n end: concat(/\"/, rawDelimiter),\n contains: [\n ESCAPED_CHARACTER(rawDelimiter),\n INTERPOLATION(rawDelimiter)\n ]\n });\n const STRING = {\n className: 'string',\n variants: [\n MULTILINE_STRING(),\n MULTILINE_STRING(\"#\"),\n MULTILINE_STRING(\"##\"),\n MULTILINE_STRING(\"###\"),\n SINGLE_LINE_STRING(),\n SINGLE_LINE_STRING(\"#\"),\n SINGLE_LINE_STRING(\"##\"),\n SINGLE_LINE_STRING(\"###\")\n ]\n };\n\n // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412\n const QUOTED_IDENTIFIER = { match: concat(/`/, identifier, /`/) };\n const IMPLICIT_PARAMETER = {\n className: 'variable',\n match: /\\$\\d+/\n };\n const PROPERTY_WRAPPER_PROJECTION = {\n className: 'variable',\n match: `\\\\$${identifierCharacter}+`\n };\n const IDENTIFIERS = [\n QUOTED_IDENTIFIER,\n IMPLICIT_PARAMETER,\n PROPERTY_WRAPPER_PROJECTION\n ];\n\n // https://docs.swift.org/swift-book/ReferenceManual/Attributes.html\n const AVAILABLE_ATTRIBUTE = {\n match: /(@|#(un)?)available/,\n className: \"keyword\",\n starts: { contains: [\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: availabilityKeywords,\n contains: [\n ...OPERATORS,\n NUMBER,\n STRING\n ]\n }\n ] }\n };\n const KEYWORD_ATTRIBUTE = {\n className: 'keyword',\n match: concat(/@/, either(...keywordAttributes))\n };\n const USER_DEFINED_ATTRIBUTE = {\n className: 'meta',\n match: concat(/@/, identifier)\n };\n const ATTRIBUTES = [\n AVAILABLE_ATTRIBUTE,\n KEYWORD_ATTRIBUTE,\n USER_DEFINED_ATTRIBUTE\n ];\n\n // https://docs.swift.org/swift-book/ReferenceManual/Types.html\n const TYPE = {\n match: lookahead(/\\b[A-Z]/),\n relevance: 0,\n contains: [\n { // Common Apple frameworks, for relevance boost\n className: 'type',\n match: concat(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/, identifierCharacter, '+')\n },\n { // Type identifier\n className: 'type',\n match: typeIdentifier,\n relevance: 0\n },\n { // Optional type\n match: /[?!]+/,\n relevance: 0\n },\n { // Variadic parameter\n match: /\\.\\.\\./,\n relevance: 0\n },\n { // Protocol composition\n match: concat(/\\s+&\\s+/, lookahead(typeIdentifier)),\n relevance: 0\n }\n ]\n };\n const GENERIC_ARGUMENTS = {\n begin: /</,\n end: />/,\n keywords: KEYWORDS,\n contains: [\n ...COMMENTS,\n ...KEYWORD_MODES,\n ...ATTRIBUTES,\n OPERATOR_GUARD,\n TYPE\n ]\n };\n TYPE.contains.push(GENERIC_ARGUMENTS);\n\n // https://docs.swift.org/swift-book/ReferenceManual/Expressions.html#ID552\n // Prevents element names from being highlighted as keywords.\n const TUPLE_ELEMENT_NAME = {\n match: concat(identifier, /\\s*:/),\n keywords: \"_|0\",\n relevance: 0\n };\n // Matches tuples as well as the parameter list of a function type.\n const TUPLE = {\n begin: /\\(/,\n end: /\\)/,\n relevance: 0,\n keywords: KEYWORDS,\n contains: [\n 'self',\n TUPLE_ELEMENT_NAME,\n ...COMMENTS,\n ...KEYWORD_MODES,\n ...BUILT_INS,\n ...OPERATORS,\n NUMBER,\n STRING,\n ...IDENTIFIERS,\n ...ATTRIBUTES,\n TYPE\n ]\n };\n\n const GENERIC_PARAMETERS = {\n begin: /</,\n end: />/,\n contains: [\n ...COMMENTS,\n TYPE\n ]\n };\n const FUNCTION_PARAMETER_NAME = {\n begin: either(\n lookahead(concat(identifier, /\\s*:/)),\n lookahead(concat(identifier, /\\s+/, identifier, /\\s*:/))\n ),\n end: /:/,\n relevance: 0,\n contains: [\n {\n className: 'keyword',\n match: /\\b_\\b/\n },\n {\n className: 'params',\n match: identifier\n }\n ]\n };\n const FUNCTION_PARAMETERS = {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS,\n contains: [\n FUNCTION_PARAMETER_NAME,\n ...COMMENTS,\n ...KEYWORD_MODES,\n ...OPERATORS,\n NUMBER,\n STRING,\n ...ATTRIBUTES,\n TYPE,\n TUPLE\n ],\n endsParent: true,\n illegal: /[\"']/\n };\n // https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362\n const FUNCTION = {\n match: [\n /func/,\n /\\s+/,\n either(QUOTED_IDENTIFIER.match, identifier, operator)\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n GENERIC_PARAMETERS,\n FUNCTION_PARAMETERS,\n WHITESPACE\n ],\n illegal: [\n /\\[/,\n /%/\n ]\n };\n\n // https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID375\n // https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID379\n const INIT_SUBSCRIPT = {\n match: [\n /\\b(?:subscript|init[?!]?)/,\n /\\s*(?=[<(])/,\n ],\n className: { 1: \"keyword\" },\n contains: [\n GENERIC_PARAMETERS,\n FUNCTION_PARAMETERS,\n WHITESPACE\n ],\n illegal: /\\[|%/\n };\n // https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID380\n const OPERATOR_DECLARATION = {\n match: [\n /operator/,\n /\\s+/,\n operator\n ],\n className: {\n 1: \"keyword\",\n 3: \"title\"\n }\n };\n\n // https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID550\n const PRECEDENCEGROUP = {\n begin: [\n /precedencegroup/,\n /\\s+/,\n typeIdentifier\n ],\n className: {\n 1: \"keyword\",\n 3: \"title\"\n },\n contains: [ TYPE ],\n keywords: [\n ...precedencegroupKeywords,\n ...literals\n ],\n end: /}/\n };\n\n // Add supported submodes to string interpolation.\n for (const variant of STRING.variants) {\n const interpolation = variant.contains.find(mode => mode.label === \"interpol\");\n // TODO: Interpolation can contain any expression, so there's room for improvement here.\n interpolation.keywords = KEYWORDS;\n const submodes = [\n ...KEYWORD_MODES,\n ...BUILT_INS,\n ...OPERATORS,\n NUMBER,\n STRING,\n ...IDENTIFIERS\n ];\n interpolation.contains = [\n ...submodes,\n {\n begin: /\\(/,\n end: /\\)/,\n contains: [\n 'self',\n ...submodes\n ]\n }\n ];\n }\n\n return {\n name: 'Swift',\n keywords: KEYWORDS,\n contains: [\n ...COMMENTS,\n FUNCTION,\n INIT_SUBSCRIPT,\n {\n beginKeywords: 'struct protocol class extension enum actor',\n end: '\\\\{',\n excludeEnd: true,\n keywords: KEYWORDS,\n contains: [\n hljs.inherit(hljs.TITLE_MODE, {\n className: \"title.class\",\n begin: /[A-Za-z$_][\\u00C0-\\u02B80-9A-Za-z$_]*/\n }),\n ...KEYWORD_MODES\n ]\n },\n OPERATOR_DECLARATION,\n PRECEDENCEGROUP,\n {\n beginKeywords: 'import',\n end: /$/,\n contains: [ ...COMMENTS ],\n relevance: 0\n },\n ...KEYWORD_MODES,\n ...BUILT_INS,\n ...OPERATORS,\n NUMBER,\n STRING,\n ...IDENTIFIERS,\n ...ATTRIBUTES,\n TYPE,\n TUPLE\n ]\n };\n}\n\nmodule.exports = swift;\n"],"names":["source","re","lookahead","concat","args","map","x","join","either","opts","length","constructor","Object","splice","stripOptionsFromArgs","capture","keywordWrapper","keyword","test","dotKeywords","optionalDotKeywords","keywordTypes","keywords","literals","precedencegroupKeywords","numberSignKeywords","builtIns","operatorHead","operatorCharacter","operator","identifierHead","identifierCharacter","identifier","typeIdentifier","keywordAttributes","availabilityKeywords","module","exports","hljs","WHITESPACE","match","relevance","BLOCK_COMMENT","COMMENT","contains","COMMENTS","C_LINE_COMMENT_MODE","DOT_KEYWORD","className","KEYWORD_GUARD","PLAIN_KEYWORDS","filter","kw","KEYWORD","variants","KEYWORDS","$pattern","literal","KEYWORD_MODES","BUILT_INS","OPERATOR_GUARD","OPERATORS","hexDigits","NUMBER","ESCAPED_CHARACTER","rawDelimiter","ESCAPED_NEWLINE","INTERPOLATION","label","begin","end","MULTILINE_STRING","SINGLE_LINE_STRING","STRING","QUOTED_IDENTIFIER","IDENTIFIERS","ATTRIBUTES","starts","TYPE","GENERIC_ARGUMENTS","push","TUPLE","GENERIC_PARAMETERS","FUNCTION_PARAMETERS","endsParent","illegal","FUNCTION","INIT_SUBSCRIPT","OPERATOR_DECLARATION","PRECEDENCEGROUP","variant","interpolation","find","mode","submodes","name","beginKeywords","excludeEnd","inherit","TITLE_MODE"],"sourceRoot":""} |