"title": "ABAP",
"owner": "dellagustin"
},
+ "abnf": {
+ "title": "Augmented Backus–Naur form",
+ "owner": "RunDevelopment"
+ },
"actionscript": {
"title": "ActionScript",
"require": "javascript",
"owner": "Golmote"
},
"asciidoc": {
+ "alias": "adoc",
"title": "AsciiDoc",
"owner": "Golmote"
},
},
"batch": {
"title": "Batch",
- "alias": "shell",
"owner": "Golmote"
},
"bison": {
"require": "c",
"owner": "Golmote"
},
+ "bnf": {
+ "title": "Backus–Naur form",
+ "alias": "rbnf",
+ "aliasTitles": {
+ "rbnf": "Routing Backus–Naur form"
+ },
+ "owner": "RunDevelopment"
+ },
"brainfuck": {
"title": "Brainfuck",
"owner": "Golmote"
"csharp": {
"title": "C#",
"require": "clike",
- "alias": "dotnet",
+ "alias": ["cs", "dotnet"],
"owner": "mvalipour"
},
"cpp": {
"require": "c",
"owner": "zeitgeist87"
},
+ "cil": {
+ "title": "CIL",
+ "owner": "sbrl"
+ },
"coffeescript": {
"title": "CoffeeScript",
"require": "javascript",
+ "alias": "coffee",
"owner": "R-osey"
},
+ "cmake": {
+ "title": "CMake",
+ "owner": "mjrogozinski"
+ },
"clojure": {
"title": "Clojure",
"owner": "troglotit"
},
"django": {
"title": "Django/Jinja2",
- "require": "markup",
- "peerDependencies": [
- "css",
- "javascript"
- ],
+ "require": "markup-templating",
"alias": "jinja2",
"owner": "romanvm"
},
"alias": "dockerfile",
"owner": "JustinBeckwith"
},
+ "ebnf": {
+ "title": "Extended Backus–Naur form",
+ "owner": "RunDevelopment"
+ },
"eiffel": {
"title": "Eiffel",
"owner": "Conaclos"
},
+ "ejs": {
+ "title": "EJS",
+ "require": ["javascript", "markup-templating"],
+ "owner": "RunDevelopment"
+ },
"elixir": {
"title": "Elixir",
"owner": "Golmote"
"title": "Fortran",
"owner": "Golmote"
},
+ "gcode": {
+ "title": "G-code",
+ "owner": "RunDevelopment"
+ },
"gedcom": {
"title": "GEDCOM",
"owner": "Golmote"
},
"haskell": {
"title": "Haskell",
+ "alias": "hs",
"owner": "bholst"
},
"haxe": {
"require": "clike",
"owner": "Golmote"
},
+ "hcl": {
+ "title": "HCL",
+ "owner": "outsideris"
+ },
"http": {
"title": "HTTP",
"peerDependencies": [
"require": "clike",
"owner": "sherblot"
},
+ "javadoc": {
+ "title": "JavaDoc",
+ "require": ["markup", "java", "javadoclike"],
+ "peerDependencies": [
+ "scala"
+ ],
+ "owner": "RunDevelopment"
+ },
+ "javadoclike": {
+ "title": "JavaDoc-like",
+ "peerDependencies": [
+ "java",
+ "javascript",
+ "php"
+ ],
+ "owner": "RunDevelopment"
+ },
+ "javastacktrace": {
+ "title": "Java stack trace",
+ "owner": "RunDevelopment"
+ },
"jolie": {
"title": "Jolie",
"require": "clike",
"owner": "thesave"
},
+ "jq": {
+ "title": "JQ",
+ "owner": "RunDevelopment"
+ },
+ "jsdoc": {
+ "title": "JSDoc",
+ "require": ["javascript", "javadoclike"],
+ "peerDependencies": [
+ "actionscript",
+ "coffeescript"
+ ],
+ "owner": "RunDevelopment"
+ },
+ "js-extras": {
+ "title": "JS Extras",
+ "require": "javascript",
+ "peerDependencies": [
+ "actionscript",
+ "coffeescript",
+ "flow",
+ "n4js",
+ "typescript"
+ ],
+ "owner": "RunDevelopment"
+ },
"json": {
"title": "JSON",
- "alias": "jsonp",
- "aliasTitles": {
- "jsonp": "JSONP"
- },
"owner": "CupOfTea696"
},
+ "jsonp": {
+ "title": "JSONP",
+ "require": "json",
+ "owner": "RunDevelopment"
+ },
+ "json5": {
+ "title": "JSON5",
+ "require": "json",
+ "owner": "RunDevelopment"
+ },
"julia": {
"title": "Julia",
"owner": "cdagnino"
},
"latex": {
"title": "LaTeX",
+ "alias": ["tex", "context"],
+ "aliasTitles": {
+ "tex": "TeX",
+ "context": "ConTeXt"
+ },
"owner": "japborst"
},
"less": {
"markdown": {
"title": "Markdown",
"require": "markup",
+ "alias": "md",
"owner": "Golmote"
},
"markup-templating": {
"title": "Monkey",
"owner": "Golmote"
},
+ "n1ql": {
+ "title": "N1QL",
+ "owner": "TMWilds"
+ },
"n4js": {
"title": "N4JS",
"require": "javascript",
+ "peerDependencies": [
+ "jsdoc"
+ ],
"alias": "n4jsd",
"owner": "bsmith-n4"
},
+ "nand2tetris-hdl": {
+ "title": "Nand To Tetris HDL",
+ "owner": "stephanmax"
+ },
"nasm": {
"title": "NASM",
"owner": "rbmj"
"require": ["clike", "markup-templating"],
"owner": "milesj"
},
+ "phpdoc": {
+ "title": "PHPDoc",
+ "require": ["php", "javadoclike"],
+ "owner": "RunDevelopment"
+ },
"php-extras": {
"title": "PHP Extras",
"require": "php",
},
"pug": {
"title": "Pug",
- "require": "javascript",
+ "require": ["markup", "javascript"],
"peerDependencies": [
"coffeescript",
"ejs",
"handlebars",
- "hogan",
"less",
"livescript",
"markdown",
- "mustache",
- "plates",
"scss",
"stylus",
- "swig"
+ "twig"
],
"owner": "Golmote"
},
"peerDependencies": [
"c",
"cpp",
- "fortran",
- "ats",
- "dsp"
+ "fortran"
],
"owner": "Golmote"
},
"python": {
"title": "Python",
+ "alias": "py",
"owner": "multipetros"
},
"q": {
"jsx": {
"title": "React JSX",
"require": ["markup", "javascript"],
+ "peerDependencies": [
+ "jsdoc",
+ "js-extras"
+ ],
"owner": "vkbansal"
},
"tsx": {
"require": "clike",
"owner": "Golmote"
},
+ "regex": {
+ "title": "Regex",
+ "peerDependencies": [
+ "actionscript",
+ "coffeescript",
+ "flow",
+ "javascript",
+ "typescript",
+ "vala"
+ ],
+ "owner": "RunDevelopment"
+ },
"rest": {
"title": "reST (reStructuredText)",
"owner": "Golmote"
"ruby": {
"title": "Ruby",
"require": "clike",
+ "alias": "rb",
"owner": "samflores"
},
"rust": {
"title": "Scheme",
"owner": "bacchus123"
},
+ "shell-session": {
+ "title": "Shell session",
+ "require": "bash",
+ "owner": "RunDevelopment"
+ },
"smalltalk": {
"title": "Smalltalk",
"owner": "Golmote"
"peerDependencies": "css",
"owner": "Golmote"
},
+ "toml": {
+ "title": "TOML",
+ "owner": "RunDevelopment"
+ },
"tt2": {
"title": "Template Toolkit 2",
"require": ["clike", "markup-templating"],
"alias": "ts",
"owner": "vkbansal"
},
+ "t4-cs": {
+ "title": "T4 Text Templates (C#)",
+ "require": ["t4-templating", "csharp"],
+ "alias": "t4",
+ "owner": "RunDevelopment"
+ },
+ "t4-vb": {
+ "title": "T4 Text Templates (VB)",
+ "require": ["t4-templating", "visual-basic"],
+ "owner": "RunDevelopment"
+ },
+ "t4-templating": {
+ "title": "T4 templating",
+ "owner": "RunDevelopment"
+ },
+ "vala": {
+ "title": "Vala",
+ "require": "clike",
+ "owner": "TemplarVolk"
+ },
"vbnet": {
"title": "VB.Net",
"require": "basic",
},
"yaml": {
"title": "YAML",
+ "alias": "yml",
"owner": "hason"
}
},
"title": "Line Numbers",
"owner": "kuba-kubula"
},
- "show-invisibles": "Show Invisibles",
+ "show-invisibles": {
+ "title": "Show Invisibles",
+ "after": [
+ "autolinker",
+ "data-uri-highlight"
+ ]
+ },
"autolinker": "Autolinker",
"wpd": "WebPlatform Docs",
"custom-class": {
--- /dev/null
+define(["prism/prism"], function () {
+(function (Prism) {
+
+ var coreRules = '(?:ALPHA|BIT|CHAR|CR|CRLF|CTL|DIGIT|DQUOTE|HEXDIG|HTAB|LF|LWSP|OCTET|SP|VCHAR|WSP)';
+
+ Prism.languages.abnf = {
+ 'comment': /;.*/,
+ 'string': {
+ pattern: /(?:%[is])?"[^"\n\r]*"/,
+ greedy: true,
+ inside: {
+ 'punctuation': /^%[is]/
+ }
+ },
+ 'range': {
+ pattern: /%(?:b[01]+-[01]+|d\d+-\d+|x[A-F\d]+-[A-F\d]+)/i,
+ alias: 'number'
+ },
+ 'terminal': {
+ pattern: /%(?:b[01]+(?:\.[01]+)*|d\d+(?:\.\d+)*|x[A-F\d]+(?:\.[A-F\d]+)*)/i,
+ alias: 'number'
+ },
+ 'repetition': {
+ pattern: /(^|[^\w-])(?:\d*\*\d*|\d+)/,
+ lookbehind: true,
+ alias: 'operator'
+ },
+ 'definition': {
+ pattern: /(^[ \t]*)(?:[a-z][\w-]*|<[^>\r\n]*>)(?=\s*=)/m,
+ lookbehind: true,
+ alias: 'keyword',
+ inside: {
+ 'punctuation': /<|>/
+ }
+ },
+ 'core-rule': {
+ pattern: RegExp('(?:(^|[^<\\w-])' + coreRules + '|<' + coreRules + '>)(?![\\w-])', 'i'),
+ lookbehind: true,
+ alias: ['rule', 'constant'],
+ inside: {
+ 'punctuation': /<|>/
+ }
+ },
+ 'rule': {
+ pattern: /(^|[^<\w-])[a-z][\w-]*|<[^>\r\n]*>/i,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /<|>/
+ }
+ },
+ 'operator': /=\/?|\//,
+ 'punctuation': /[()\[\]]/
+ };
+
+})(Prism);
+
+return Prism; })
\ No newline at end of file
Prism.languages.apacheconf = {
'comment': /#.*/,
'directive-inline': {
- pattern: /^(\s*)\b(?:AcceptFilter|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding|AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch|Allow|AllowCONNECT|AllowEncodedSlashes|AllowMethods|AllowOverride|AllowOverrideList|Anonymous|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail|AsyncRequestWorkerFactor|AuthBasicAuthoritative|AuthBasicFake|AuthBasicProvider|AuthBasicUseDigestAlgorithm|AuthDBDUserPWQuery|AuthDBDUserRealmQuery|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm|AuthDigestDomain|AuthDigestNonceLifetime|AuthDigestProvider|AuthDigestQop|AuthDigestShmemSize|AuthFormAuthoritative|AuthFormBody|AuthFormDisableNoStore|AuthFormFakeBasicAuth|AuthFormLocation|AuthFormLoginRequiredLocation|AuthFormLoginSuccessLocation|AuthFormLogoutLocation|AuthFormMethod|AuthFormMimetype|AuthFormPassword|AuthFormProvider|AuthFormSitePassphrase|AuthFormSize|AuthFormUsername|AuthGroupFile|AuthLDAPAuthorizePrefix|AuthLDAPBindAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareAsUser|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPInitialBindAsUser|AuthLDAPInitialBindPattern|AuthLDAPMaxSubGroupDepth|AuthLDAPRemoteUserAttribute|AuthLDAPRemoteUserIsDN|AuthLDAPSearchAsUser|AuthLDAPSubGroupAttribute|AuthLDAPSubGroupClass|AuthLDAPUrl|AuthMerging|AuthName|AuthnCacheContext|AuthnCacheEnable|AuthnCacheProvideFor|AuthnCacheSOCache|AuthnCacheTimeout|AuthnzFcgiCheckAuthnProvider|AuthnzFcgiDefineProvider|AuthType|AuthUserFile|AuthzDBDLoginToReferer|AuthzDBDQuery|AuthzDBDRedirectQuery|AuthzDBMType|AuthzSendForbiddenOnFailure|BalancerGrowth|BalancerInherit|BalancerMember|BalancerPersist|BrowserMatch|BrowserMatchNoCase|BufferedLogs|BufferSize|CacheDefaultExpire|CacheDetailHeader|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheFile|CacheHeader|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheIgnoreQueryString|CacheIgnoreURLSessionIdentifiers|CacheKeyBaseURL|CacheLastModifiedFactor|CacheLock|CacheLockMaxAge|CacheLockPath|CacheMaxExpire|CacheMaxFileSize|CacheMinExpire|CacheMinFileSize|CacheNegotiatedDocs|CacheQuickHandler|CacheReadSize|CacheReadTime|CacheRoot|CacheSocache|CacheSocacheMaxSize|CacheSocacheMaxTime|CacheSocacheMinTime|CacheSocacheReadSize|CacheSocacheReadTime|CacheStaleOnError|CacheStoreExpired|CacheStoreNoStore|CacheStorePrivate|CGIDScriptTimeout|CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckCaseOnly|CheckSpelling|ChrootDir|ContentDigest|CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavGenericLockDB|DavLockDB|DavMinTimeout|DBDExptime|DBDInitSQL|DBDKeep|DBDMax|DBDMin|DBDParams|DBDPersist|DBDPrepareSQL|DBDriver|DefaultIcon|DefaultLanguage|DefaultRuntimeDir|DefaultType|Define|DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateInflateLimitRequestBody|DeflateInflateRatioBurst|DeflateInflateRatioLimit|DeflateMemLevel|DeflateWindowSize|Deny|DirectoryCheckHandler|DirectoryIndex|DirectoryIndexRedirect|DirectorySlash|DocumentRoot|DTracePrivileges|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|Error|ErrorDocument|ErrorLog|ErrorLogFormat|Example|ExpiresActive|ExpiresByType|ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FallbackResource|FileETag|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace|ForceLanguagePriority|ForceType|ForensicLog|GprofDir|GracefulShutdownTimeout|Group|Header|HeaderName|HeartbeatAddress|HeartbeatListen|HeartbeatMaxServers|HeartbeatStorage|HeartbeatStorage|HostnameLookups|IdentityCheck|IdentityCheckTimeout|ImapBase|ImapDefault|ImapMenu|Include|IncludeOptional|IndexHeadInsert|IndexIgnore|IndexIgnoreReset|IndexOptions|IndexOrderDefault|IndexStyleSheet|InputSed|ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout|KeptBodySize|LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionPoolTTL|LDAPConnectionTimeout|LDAPLibraryDebug|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPReferralHopLimit|LDAPReferrals|LDAPRetries|LDAPRetryDelay|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTimeout|LDAPTrustedClientCert|LDAPTrustedGlobalCert|LDAPTrustedMode|LDAPVerifyServerCert|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|LogFormat|LogLevel|LogMessage|LuaAuthzProvider|LuaCodeCache|LuaHookAccessChecker|LuaHookAuthChecker|LuaHookCheckUserID|LuaHookFixups|LuaHookInsertFilter|LuaHookLog|LuaHookMapToStorage|LuaHookTranslateName|LuaHookTypeChecker|LuaInherit|LuaInputFilter|LuaMapHandler|LuaOutputFilter|LuaPackageCPath|LuaPackagePath|LuaQuickHandler|LuaRoot|LuaScope|MaxConnectionsPerChild|MaxKeepAliveRequests|MaxMemFree|MaxRangeOverlaps|MaxRangeReversals|MaxRanges|MaxRequestWorkers|MaxSpareServers|MaxSpareThreads|MaxThreads|MergeTrailers|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads|MMapFile|ModemStandard|ModMimeUsePathInfo|MultiviewsMatch|Mutex|NameVirtualHost|NoProxy|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|OutputSed|PassEnv|PidFile|PrivilegesMode|Protocol|ProtocolEcho|ProxyAddHeaders|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyExpressDBMFile|ProxyExpressDBMType|ProxyExpressEnable|ProxyFtpDirCharset|ProxyFtpEscapeWildcards|ProxyFtpListOnWildcard|ProxyHTMLBufSize|ProxyHTMLCharsetOut|ProxyHTMLDocType|ProxyHTMLEnable|ProxyHTMLEvents|ProxyHTMLExtended|ProxyHTMLFixups|ProxyHTMLInterp|ProxyHTMLLinks|ProxyHTMLMeta|ProxyHTMLStripComments|ProxyHTMLURLMap|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassInherit|ProxyPassInterpolateEnv|ProxyPassMatch|ProxyPassReverse|ProxyPassReverseCookieDomain|ProxyPassReverseCookiePath|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxySCGIInternalRedirect|ProxySCGISendfile|ProxySet|ProxySourceAddress|ProxyStatus|ProxyTimeout|ProxyVia|ReadmeName|ReceiveBufferSize|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ReflectorHeader|RemoteIPHeader|RemoteIPInternalProxy|RemoteIPInternalProxyList|RemoteIPProxiesHeader|RemoteIPTrustedProxy|RemoteIPTrustedProxyList|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader|RequestReadTimeout|Require|RewriteBase|RewriteCond|RewriteEngine|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen|SeeRequestTail|SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|Session|SessionCookieName|SessionCookieName2|SessionCookieRemove|SessionCryptoCipher|SessionCryptoDriver|SessionCryptoPassphrase|SessionCryptoPassphraseFile|SessionDBDCookieName|SessionDBDCookieName2|SessionDBDCookieRemove|SessionDBDDeleteLabel|SessionDBDInsertLabel|SessionDBDPerUser|SessionDBDSelectLabel|SessionDBDUpdateLabel|SessionEnv|SessionExclude|SessionHeader|SessionInclude|SessionMaxAge|SetEnv|SetEnvIf|SetEnvIfExpr|SetEnvIfNoCase|SetHandler|SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIETag|SSILastModified|SSILegacyExprParser|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath|SSLCADNRequestFile|SSLCADNRequestPath|SSLCARevocationCheck|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLCompression|SSLCryptoDevice|SSLEngine|SSLFIPS|SSLHonorCipherOrder|SSLInsecureRenegotiation|SSLOCSPDefaultResponder|SSLOCSPEnable|SSLOCSPOverrideResponder|SSLOCSPResponderTimeout|SSLOCSPResponseMaxAge|SSLOCSPResponseTimeSkew|SSLOCSPUseRequestNonce|SSLOpenSSLConfCmd|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationCheck|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCheckPeerCN|SSLProxyCheckPeerExpire|SSLProxyCheckPeerName|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateChainFile|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRenegBufferSize|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLSessionTicketKeyFile|SSLSRPUnknownUserSeed|SSLSRPVerifierFile|SSLStaplingCache|SSLStaplingErrorCacheTimeout|SSLStaplingFakeTryLater|SSLStaplingForceURL|SSLStaplingResponderTimeout|SSLStaplingResponseMaxAge|SSLStaplingResponseTimeSkew|SSLStaplingReturnResponderErrors|SSLStaplingStandardCacheTimeout|SSLStrictSNIVHostCheck|SSLUserName|SSLUseStapling|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|Substitute|Suexec|SuexecUserGroup|ThreadLimit|ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnDefine|UndefMacro|UnsetEnv|Use|UseCanonicalName|UseCanonicalPhysicalPort|User|UserDir|VHostCGIMode|VHostCGIPrivs|VHostGroup|VHostPrivs|VHostSecure|VHostUser|VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP|WatchdogInterval|XBitHack|xml2EncAlias|xml2EncDefault|xml2StartParse)\b/mi,
+ pattern: /(^\s*)\b(?:AcceptFilter|AcceptPathInfo|AccessFileName|Action|Add(?:Alt|AltByEncoding|AltByType|Charset|DefaultCharset|Description|Encoding|Handler|Icon|IconByEncoding|IconByType|InputFilter|Language|ModuleInfo|OutputFilter|OutputFilterByType|Type)|Alias|AliasMatch|Allow(?:CONNECT|EncodedSlashes|Methods|Override|OverrideList)?|Anonymous(?:_LogEmail|_MustGiveEmail|_NoUserID|_VerifyEmail)?|AsyncRequestWorkerFactor|Auth(?:BasicAuthoritative|BasicFake|BasicProvider|BasicUseDigestAlgorithm|DBDUserPWQuery|DBDUserRealmQuery|DBMGroupFile|DBMType|DBMUserFile|Digest(?:Algorithm|Domain|NonceLifetime|Provider|Qop|ShmemSize)|Form(?:Authoritative|Body|DisableNoStore|FakeBasicAuth|Location|LoginRequiredLocation|LoginSuccessLocation|LogoutLocation|Method|Mimetype|Password|Provider|SitePassphrase|Size|Username)|GroupFile|LDAP(?:AuthorizePrefix|BindAuthoritative|BindDN|BindPassword|CharsetConfig|CompareAsUser|CompareDNOnServer|DereferenceAliases|GroupAttribute|GroupAttributeIsDN|InitialBindAsUser|InitialBindPattern|MaxSubGroupDepth|RemoteUserAttribute|RemoteUserIsDN|SearchAsUser|SubGroupAttribute|SubGroupClass|Url)|Merging|Name|Type|UserFile|nCache(?:Context|Enable|ProvideFor|SOCache|Timeout)|nzFcgiCheckAuthnProvider|nzFcgiDefineProvider|zDBDLoginToReferer|zDBDQuery|zDBDRedirectQuery|zDBMType|zSendForbiddenOnFailure)|BalancerGrowth|BalancerInherit|BalancerMember|BalancerPersist|BrowserMatch|BrowserMatchNoCase|BufferSize|BufferedLogs|CGIDScriptTimeout|CGIMapExtension|Cache(?:DefaultExpire|DetailHeader|DirLength|DirLevels|Disable|Enable|File|Header|IgnoreCacheControl|IgnoreHeaders|IgnoreNoLastMod|IgnoreQueryString|IgnoreURLSessionIdentifiers|KeyBaseURL|LastModifiedFactor|Lock|LockMaxAge|LockPath|MaxExpire|MaxFileSize|MinExpire|MinFileSize|NegotiatedDocs|QuickHandler|ReadSize|ReadTime|Root|Socache(?:MaxSize|MaxTime|MinTime|ReadSize|ReadTime)?|StaleOnError|StoreExpired|StoreNoStore|StorePrivate)|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckCaseOnly|CheckSpelling|ChrootDir|ContentDigest|CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|DBDExptime|DBDInitSQL|DBDKeep|DBDMax|DBDMin|DBDParams|DBDPersist|DBDPrepareSQL|DBDriver|DTracePrivileges|Dav|DavDepthInfinity|DavGenericLockDB|DavLockDB|DavMinTimeout|DefaultIcon|DefaultLanguage|DefaultRuntimeDir|DefaultType|Define|Deflate(?:BufferSize|CompressionLevel|FilterNote|InflateLimitRequestBody|InflateRatio(?:Burst|Limit)|MemLevel|WindowSize)|Deny|DirectoryCheckHandler|DirectoryIndex|DirectoryIndexRedirect|DirectorySlash|DocumentRoot|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|Error|ErrorDocument|ErrorLog|ErrorLogFormat|Example|ExpiresActive|ExpiresByType|ExpiresDefault|ExtFilterDefine|ExtFilterOptions|ExtendedStatus|FallbackResource|FileETag|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace|ForceLanguagePriority|ForceType|ForensicLog|GprofDir|GracefulShutdownTimeout|Group|Header|HeaderName|Heartbeat(?:Address|Listen|MaxServers|Storage)|HostnameLookups|ISAPI(?:AppendLogToErrors|AppendLogToQuery|CacheFile|FakeAsync|LogNotSupported|ReadAheadBuffer)|IdentityCheck|IdentityCheckTimeout|ImapBase|ImapDefault|ImapMenu|Include|IncludeOptional|Index(?:HeadInsert|Ignore|IgnoreReset|Options|OrderDefault|StyleSheet)|InputSed|KeepAlive|KeepAliveTimeout|KeptBodySize|LDAP(?:CacheEntries|CacheTTL|ConnectionPoolTTL|ConnectionTimeout|LibraryDebug|OpCacheEntries|OpCacheTTL|ReferralHopLimit|Referrals|Retries|RetryDelay|SharedCacheFile|SharedCacheSize|Timeout|TrustedClientCert|TrustedGlobalCert|TrustedMode|VerifyServerCert)|LanguagePriority|Limit(?:InternalRecursion|Request(?:Body|FieldSize|Fields|Line)|XMLRequestBody)|Listen|ListenBackLog|LoadFile|LoadModule|LogFormat|LogLevel|LogMessage|LuaAuthzProvider|LuaCodeCache|Lua(?:Hook(?:AccessChecker|AuthChecker|CheckUserID|Fixups|InsertFilter|Log|MapToStorage|TranslateName|TypeChecker)|Inherit|InputFilter|MapHandler|OutputFilter|PackageCPath|PackagePath|QuickHandler|Root|Scope)|MMapFile|Max(?:ConnectionsPerChild|KeepAliveRequests|MemFree|RangeOverlaps|RangeReversals|Ranges|RequestWorkers|SpareServers|SpareThreads|Threads)|MergeTrailers|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads|ModMimeUsePathInfo|ModemStandard|MultiviewsMatch|Mutex|NWSSLTrustedCerts|NWSSLUpgradeable|NameVirtualHost|NoProxy|Options|Order|OutputSed|PassEnv|PidFile|PrivilegesMode|Protocol|ProtocolEcho|Proxy(?:AddHeaders|BadHeader|Block|Domain|ErrorOverride|ExpressDBMFile|ExpressDBMType|ExpressEnable|FtpDirCharset|FtpEscapeWildcards|FtpListOnWildcard|HTML(?:BufSize|CharsetOut|DocType|Enable|Events|Extended|Fixups|Interp|Links|Meta|StripComments|URLMap)|IOBufferSize|MaxForwards|Pass(?:Inherit|InterpolateEnv|Match|Reverse|ReverseCookieDomain|ReverseCookiePath)?|PreserveHost|ReceiveBufferSize|Remote|RemoteMatch|Requests|SCGIInternalRedirect|SCGISendfile|Set|SourceAddress|Status|Timeout|Via)|RLimitCPU|RLimitMEM|RLimitNPROC|ReadmeName|ReceiveBufferSize|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ReflectorHeader|RemoteIP(?:Header|InternalProxy|InternalProxyList|ProxiesHeader|TrustedProxy|TrustedProxyList)|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader|RequestReadTimeout|Require|Rewrite(?:Base|Cond|Engine|Map|Options|Rule)|SSIETag|SSIEndTag|SSIErrorMsg|SSILastModified|SSILegacyExprParser|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSL(?:CACertificateFile|CACertificatePath|CADNRequestFile|CADNRequestPath|CARevocationCheck|CARevocationFile|CARevocationPath|CertificateChainFile|CertificateFile|CertificateKeyFile|CipherSuite|Compression|CryptoDevice|Engine|FIPS|HonorCipherOrder|InsecureRenegotiation|OCSP(?:DefaultResponder|Enable|OverrideResponder|ResponderTimeout|ResponseMaxAge|ResponseTimeSkew|UseRequestNonce)|OpenSSLConfCmd|Options|PassPhraseDialog|Protocol|Proxy(?:CACertificateFile|CACertificatePath|CARevocation(?:Check|File|Path)|CheckPeer(?:CN|Expire|Name)|CipherSuite|Engine|MachineCertificate(?:ChainFile|File|Path)|Protocol|Verify|VerifyDepth)|RandomSeed|RenegBufferSize|Require|RequireSSL|SRPUnknownUserSeed|SRPVerifierFile|Session(?:Cache|CacheTimeout|TicketKeyFile|Tickets)|Stapling(?:Cache|ErrorCacheTimeout|FakeTryLater|ForceURL|ResponderTimeout|ResponseMaxAge|ResponseTimeSkew|ReturnResponderErrors|StandardCacheTimeout)|StrictSNIVHostCheck|UseStapling|UserName|VerifyClient|VerifyDepth)|Satisfy|ScoreBoardFile|Script(?:Alias|AliasMatch|InterpreterSource|Log|LogBuffer|LogLength|Sock)?|SecureListen|SeeRequestTail|SendBufferSize|Server(?:Admin|Alias|Limit|Name|Path|Root|Signature|Tokens)|Session(?:Cookie(?:Name|Name2|Remove)|Crypto(?:Cipher|Driver|Passphrase|PassphraseFile)|DBD(?:CookieName|CookieName2|CookieRemove|DeleteLabel|InsertLabel|PerUser|SelectLabel|UpdateLabel)|Env|Exclude|Header|Include|MaxAge)?|SetEnv|SetEnvIf|SetEnvIfExpr|SetEnvIfNoCase|SetHandler|SetInputFilter|SetOutputFilter|StartServers|StartThreads|Substitute|Suexec|SuexecUserGroup|ThreadLimit|ThreadStackSize|ThreadsPerChild|TimeOut|TraceEnable|TransferLog|TypesConfig|UnDefine|UndefMacro|UnsetEnv|Use|UseCanonicalName|UseCanonicalPhysicalPort|User|UserDir|VHostCGIMode|VHostCGIPrivs|VHostGroup|VHostPrivs|VHostSecure|VHostUser|Virtual(?:DocumentRoot|ScriptAlias)(?:IP)?|WatchdogInterval|XBitHack|xml2EncAlias|xml2EncDefault|xml2StartParse)\b/im,
lookbehind: true,
alias: 'property'
},
'directive-block': {
- pattern: /<\/?\b(?:AuthnProviderAlias|AuthzProviderAlias|Directory|DirectoryMatch|Else|ElseIf|Files|FilesMatch|If|IfDefine|IfModule|IfVersion|Limit|LimitExcept|Location|LocationMatch|Macro|Proxy|RequireAll|RequireAny|RequireNone|VirtualHost)\b *.*>/i,
+ pattern: /<\/?\b(?:Auth[nz]ProviderAlias|Directory|DirectoryMatch|Else|ElseIf|Files|FilesMatch|If|IfDefine|IfModule|IfVersion|Limit|LimitExcept|Location|LocationMatch|Macro|Proxy|Require(?:All|Any|None)|VirtualHost)\b *.*>/i,
inside: {
'directive-block': {
pattern: /^<\/?\w+/,
'attr-value': /(?!^\s+$).+/
}
};
- Prism.languages.asciidoc = {
+
+ var asciidoc = Prism.languages.asciidoc = {
'comment-block': {
pattern: /^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,
alias: 'comment'
// Allow some nesting. There is no recursion though, so cloning should not be needed.
- attributes.inside['interpreted'].inside.rest = {
- 'macro': Prism.languages.asciidoc['macro'],
- 'inline': Prism.languages.asciidoc['inline'],
- 'replacement': Prism.languages.asciidoc['replacement'],
- 'entity': Prism.languages.asciidoc['entity']
- };
+ function copyFromAsciiDoc(keys) {
+ keys = keys.split(' ');
- Prism.languages.asciidoc['passthrough-block'].inside.rest = {
- 'macro': Prism.languages.asciidoc['macro']
- };
+ var o = {};
+ for (var i = 0, l = keys.length; i < l; i++) {
+ o[keys[i]] = asciidoc[keys[i]];
+ }
+ return o;
+ }
- Prism.languages.asciidoc['literal-block'].inside.rest = {
- 'callout': Prism.languages.asciidoc['callout']
- };
+ attributes.inside['interpreted'].inside.rest = copyFromAsciiDoc('macro inline replacement entity');
- Prism.languages.asciidoc['table'].inside.rest = {
- 'comment-block': Prism.languages.asciidoc['comment-block'],
- 'passthrough-block': Prism.languages.asciidoc['passthrough-block'],
- 'literal-block': Prism.languages.asciidoc['literal-block'],
- 'other-block': Prism.languages.asciidoc['other-block'],
- 'list-punctuation': Prism.languages.asciidoc['list-punctuation'],
- 'indented-block': Prism.languages.asciidoc['indented-block'],
- 'comment': Prism.languages.asciidoc['comment'],
- 'title': Prism.languages.asciidoc['title'],
- 'attribute-entry': Prism.languages.asciidoc['attribute-entry'],
- 'attributes': Prism.languages.asciidoc['attributes'],
- 'hr': Prism.languages.asciidoc['hr'],
- 'page-break': Prism.languages.asciidoc['page-break'],
- 'admonition': Prism.languages.asciidoc['admonition'],
- 'list-label': Prism.languages.asciidoc['list-label'],
- 'callout': Prism.languages.asciidoc['callout'],
- 'macro': Prism.languages.asciidoc['macro'],
- 'inline': Prism.languages.asciidoc['inline'],
- 'replacement': Prism.languages.asciidoc['replacement'],
- 'entity': Prism.languages.asciidoc['entity'],
- 'line-continuation': Prism.languages.asciidoc['line-continuation']
- };
+ asciidoc['passthrough-block'].inside.rest = copyFromAsciiDoc('macro');
- Prism.languages.asciidoc['other-block'].inside.rest = {
- 'table': Prism.languages.asciidoc['table'],
- 'list-punctuation': Prism.languages.asciidoc['list-punctuation'],
- 'indented-block': Prism.languages.asciidoc['indented-block'],
- 'comment': Prism.languages.asciidoc['comment'],
- 'attribute-entry': Prism.languages.asciidoc['attribute-entry'],
- 'attributes': Prism.languages.asciidoc['attributes'],
- 'hr': Prism.languages.asciidoc['hr'],
- 'page-break': Prism.languages.asciidoc['page-break'],
- 'admonition': Prism.languages.asciidoc['admonition'],
- 'list-label': Prism.languages.asciidoc['list-label'],
- 'macro': Prism.languages.asciidoc['macro'],
- 'inline': Prism.languages.asciidoc['inline'],
- 'replacement': Prism.languages.asciidoc['replacement'],
- 'entity': Prism.languages.asciidoc['entity'],
- 'line-continuation': Prism.languages.asciidoc['line-continuation']
- };
+ asciidoc['literal-block'].inside.rest = copyFromAsciiDoc('callout');
+
+ asciidoc['table'].inside.rest = copyFromAsciiDoc('comment-block passthrough-block literal-block other-block list-punctuation indented-block comment title attribute-entry attributes hr page-break admonition list-label callout macro inline replacement entity line-continuation');
+
+ asciidoc['other-block'].inside.rest = copyFromAsciiDoc('table list-punctuation indented-block comment attribute-entry attributes hr page-break admonition list-label macro inline replacement entity line-continuation');
+
+ asciidoc['title'].inside.rest = copyFromAsciiDoc('macro inline replacement entity');
- Prism.languages.asciidoc['title'].inside.rest = {
- 'macro': Prism.languages.asciidoc['macro'],
- 'inline': Prism.languages.asciidoc['inline'],
- 'replacement': Prism.languages.asciidoc['replacement'],
- 'entity': Prism.languages.asciidoc['entity']
- };
// Plugin to make entity title show the real entity, idea by Roman Komarov
- Prism.hooks.add('wrap', function(env) {
+ Prism.hooks.add('wrap', function (env) {
if (env.type === 'entity') {
env.attributes['title'] = env.content.replace(/&/, '&');
}
});
+
+ Prism.languages.adoc = Prism.languages.asciidoc;
}(Prism));
+
return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
(function(Prism) {
+ // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
+ // + LC_ALL, RANDOM, REPLY, SECONDS.
+ // + make sure PS1..4 are here as they are not always set,
+ // - some useless things.
+ var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
var insideString = {
- variable: [
- // Arithmetic Environment
+ 'environment': {
+ pattern: RegExp("\\$" + envVars),
+ alias: 'constant'
+ },
+ 'variable': [
+ // [0]: Arithmetic Environment
{
pattern: /\$?\(\([\s\S]+?\)\)/,
+ greedy: true,
inside: {
// If there is a $ sign at the beginning highlight $(( and )) as variable
- variable: [{
+ 'variable': [
+ {
pattern: /(^\$\(\([\s\S]+)\)\)/,
lookbehind: true
},
/^\$\(\(/
],
- number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,
+ 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
- operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
+ 'operator': /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
// If there is no $ sign at the beginning highlight (( and )) as punctuation
- punctuation: /\(\(?|\)\)?|,|;/
+ 'punctuation': /\(\(?|\)\)?|,|;/
+ }
+ },
+ // [1]: Command Substitution
+ {
+ pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
+ greedy: true,
+ inside: {
+ 'variable': /^\$\(|^`|\)$|`$/
}
},
- // Command Substitution
+ // [2]: Brace expansion
{
- pattern: /\$\([^)]+\)|`[^`]+`/,
+ pattern: /\$\{[^}]+\}/,
greedy: true,
inside: {
- variable: /^\$\(|^`|\)$|`$/
+ 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
+ 'punctuation': /[\[\]]/,
+ 'environment': {
+ pattern: RegExp("(\\{)" + envVars),
+ lookbehind: true,
+ alias: 'constant'
+ }
}
},
- /\$(?:[\w#?*!@]+|\{[^}]+\})/i
- ]
+ /\$(?:\w+|[#?*!@$])/
+ ],
+ // Escape sequences from echo and printf's manuals, and escaped quotes.
+ 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/
};
Prism.languages.bash = {
'shebang': {
- pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,
+ pattern: /^#!\s*\/.*/,
alias: 'important'
},
'comment': {
- pattern: /(^|[^"{\\])#.*/,
+ pattern: /(^|[^"{\\$])#.*/,
+ lookbehind: true
+ },
+ 'function-name': [
+ // a) function foo {
+ // b) foo() {
+ // c) function foo() {
+ // but not “foo {”
+ {
+ // a) and c)
+ pattern: /(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/,
+ lookbehind: true,
+ alias: 'function'
+ },
+ {
+ // b)
+ pattern: /\b\w+(?=\s*\(\s*\)\s*\{)/,
+ alias: 'function'
+ }
+ ],
+ // Highlight variable names as variables in for and select beginnings.
+ 'for-or-select': {
+ pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
+ alias: 'variable',
+ lookbehind: true
+ },
+ // Highlight variable names as variables in the left-hand part
+ // of assignments (“=” and “+=”).
+ 'assign-left': {
+ pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
+ inside: {
+ 'environment': {
+ pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
+ lookbehind: true,
+ alias: 'constant'
+ }
+ },
+ alias: 'variable',
lookbehind: true
},
'string': [
- //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document
+ // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
{
- pattern: /((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/,
+ pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\2/,
lookbehind: true,
greedy: true,
inside: insideString
},
+ // Here-document with quotes around the tag
+ // → No expansion (so no “inside”).
+ {
+ pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\3/,
+ lookbehind: true,
+ greedy: true
+ },
+ // “Normal” string
{
pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,
greedy: true,
inside: insideString
}
],
+ 'environment': {
+ pattern: RegExp("\\$?" + envVars),
+ alias: 'constant'
+ },
'variable': insideString.variable,
- // Originally based on http://ss64.com/bash/
'function': {
- pattern: /(^|[\s;|&])(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\s;|&])/,
+ pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
lookbehind: true
},
'keyword': {
- pattern: /(^|[\s;|&])(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|[\s;|&])/,
+ pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,
lookbehind: true
},
+ // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
+ 'builtin': {
+ pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,
+ lookbehind: true,
+ // Alias added to make those easier to distinguish from strings.
+ alias: 'class-name'
+ },
'boolean': {
- pattern: /(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/,
+ pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,
lookbehind: true
},
- 'operator': /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,
- 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
+ 'file-descriptor': {
+ pattern: /\B&\d\b/,
+ alias: 'important'
+ },
+ 'operator': {
+ // Lots of redirections here, but not just that.
+ pattern: /\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/,
+ inside: {
+ 'file-descriptor': {
+ pattern: /^\d/,
+ alias: 'important'
+ }
+ }
+ },
+ 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
+ 'number': {
+ pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
+ lookbehind: true
+ }
};
+ /* Patterns in command substitution. */
+ var toBeCopied = [
+ 'comment',
+ 'function-name',
+ 'for-or-select',
+ 'assign-left',
+ 'string',
+ 'environment',
+ 'function',
+ 'keyword',
+ 'builtin',
+ 'boolean',
+ 'file-descriptor',
+ 'operator',
+ 'punctuation',
+ 'number'
+ ];
var inside = insideString.variable[1].inside;
- inside.string = Prism.languages.bash.string;
- inside['function'] = Prism.languages.bash['function'];
- inside.keyword = Prism.languages.bash.keyword;
- inside['boolean'] = Prism.languages.bash['boolean'];
- inside.operator = Prism.languages.bash.operator;
- inside.punctuation = Prism.languages.bash.punctuation;
-
+ for(var i = 0; i < toBeCopied.length; i++) {
+ inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
+ }
+
Prism.languages.shell = Prism.languages.bash;
})(Prism);
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.bnf = {
+ 'string': {
+ pattern: /"[^\r\n"]*"|'[^\r\n']*'/
+ },
+ 'definition': {
+ pattern: /<[^<>\r\n\t]+>(?=\s*::=)/,
+ alias: ['rule', 'keyword'],
+ inside: {
+ 'punctuation': /^<|>$/
+ }
+ },
+ 'rule': {
+ pattern: /<[^<>\r\n\t]+>/,
+ inside: {
+ 'punctuation': /^<|>$/
+ }
+ },
+ 'operator': /::=|[|()[\]{}*+?]|\.{3}/
+};
+
+Prism.languages.rbnf = Prism.languages.bnf;
+
+return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-clike"], function () {
Prism.languages.c = Prism.languages.extend('clike', {
+ 'class-name': {
+ pattern: /(\b(?:enum|struct)\s+)\w+/,
+ lookbehind: true
+ },
'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,
- 'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
+ 'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
});
Prism.languages.insertBefore('c', 'string', {
'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
});
-delete Prism.languages.c['class-name'];
delete Prism.languages.c['boolean'];
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.cil = {
+ 'comment': /\/\/.*/,
+
+ 'string': {
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+ greedy: true
+ },
+
+ 'directive': {
+ pattern: /(^|\W)\.[a-z]+(?=\s)/,
+ lookbehind: true,
+ alias: 'class-name'
+ },
+
+ // Actually an assembly reference
+ 'variable': /\[[\w\.]+\]/,
+
+
+ 'keyword': /\b(?:abstract|ansi|assembly|auto|autochar|beforefieldinit|bool|bstr|byvalstr|catch|char|cil|class|currency|date|decimal|default|enum|error|explicit|extends|extern|famandassem|family|famorassem|final(?:ly)?|float32|float64|hidebysig|iant|idispatch|implements|import|initonly|instance|u?int(?:8|16|32|64)?|interface|iunknown|literal|lpstr|lpstruct|lptstr|lpwstr|managed|method|native(?:Type)?|nested|newslot|object(?:ref)?|pinvokeimpl|private|privatescope|public|reqsecobj|rtspecialname|runtime|sealed|sequential|serializable|specialname|static|string|struct|syschar|tbstr|unicode|unmanagedexp|unsigned|value(?:type)?|variant|virtual|void)\b/,
+
+ 'function': /\b(?:(?:constrained|unaligned|volatile|readonly|tail|no)\.)?(?:conv\.(?:[iu][1248]?|ovf\.[iu][1248]?(?:\.un)?|r\.un|r4|r8)|ldc\.(?:i4(?:\.[0-9]+|\.[mM]1|\.s)?|i8|r4|r8)|ldelem(?:\.[iu][1248]?|\.r[48]|\.ref|a)?|ldind\.(?:[iu][1248]?|r[48]|ref)|stelem\.?(?:i[1248]?|r[48]|ref)?|stind\.(i[1248]?|r[48]|ref)?|end(?:fault|filter|finally)|ldarg(?:\.[0-3s]|a(?:\.s)?)?|ldloc(?:\.[0-9]+|\.s)?|sub(?:\.ovf(?:\.un)?)?|mul(?:\.ovf(?:\.un)?)?|add(?:\.ovf(?:\.un)?)?|stloc(?:\.[0-3s])?|refany(?:type|val)|blt(?:\.un)?(?:\.s)?|ble(?:\.un)?(?:\.s)?|bgt(?:\.un)?(?:\.s)?|bge(?:\.un)?(?:\.s)?|unbox(?:\.any)?|init(?:blk|obj)|call(?:i|virt)?|brfalse(?:\.s)?|bne\.un(?:\.s)?|ldloca(?:\.s)?|brzero(?:\.s)?|brtrue(?:\.s)?|brnull(?:\.s)?|brinst(?:\.s)?|starg(?:\.s)?|leave(?:\.s)?|shr(?:\.un)?|rem(?:\.un)?|div(?:\.un)?|clt(?:\.un)?|alignment|ldvirtftn|castclass|beq(?:\.s)?|mkrefany|localloc|ckfinite|rethrow|ldtoken|ldsflda|cgt\.un|arglist|switch|stsfld|sizeof|newobj|newarr|ldsfld|ldnull|ldflda|isinst|throw|stobj|stloc|stfld|ldstr|ldobj|ldlen|ldftn|ldfld|cpobj|cpblk|break|br\.s|xor|shl|ret|pop|not|nop|neg|jmp|dup|clt|cgt|ceq|box|and|or|br)\b/,
+
+ 'boolean': /\b(?:true|false)\b/,
+ 'number': /\b-?(?:0x[0-9a-fA-F]+|[0-9]+)(?:\.[0-9a-fA-F]+)?\b/i,
+
+ 'punctuation': /[{}[\];(),:=]|IL_[0-9A-Za-z]+/
+}
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.cmake = {
+ 'comment': /#.*/,
+ 'string': {
+ pattern: /"(?:[^\\"]|\\.)*"/,
+ greedy: true,
+ inside: {
+ 'interpolation': {
+ pattern: /\${(?:[^{}$]|\${[^{}$]*})*}/,
+ inside: {
+ 'punctuation': /\${|}/,
+ 'variable': /\w+/
+ }
+ }
+ }
+ },
+ 'variable': /\b(?:CMAKE_\w+|\w+_(?:VERSION(?:_MAJOR|_MINOR|_PATCH|_TWEAK)?|(?:BINARY|SOURCE)_DIR|DESCRIPTION|HOMEPAGE_URL|ROOT)|(?:CTEST_CUSTOM_(?:MAXIMUM_(?:(?:FAIL|PASS)ED_TEST_OUTPUT_SIZE|NUMBER_OF_(?:ERROR|WARNING)S)|ERROR_(?:P(?:OST|RE)_CONTEXT|EXCEPTION|MATCH)|P(?:OST|RE)_MEMCHECK|WARNING_(?:EXCEPTION|MATCH)|(?:MEMCHECK|TESTS)_IGNORE|P(?:OST|RE)_TEST|COVERAGE_EXCLUDE)|ANDROID|APPLE|BORLAND|BUILD_SHARED_LIBS|CACHE|CPACK_(?:ABSOLUTE_DESTINATION_FILES|COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY|ERROR_ON_ABSOLUTE_INSTALL_DESTINATION|INCLUDE_TOPLEVEL_DIRECTORY|INSTALL_DEFAULT_DIRECTORY_PERMISSIONS|INSTALL_SCRIPT|PACKAGING_INSTALL_PREFIX|SET_DESTDIR|WARN_ON_ABSOLUTE_INSTALL_DESTINATION)|CTEST_(?:BINARY_DIRECTORY|BUILD_COMMAND|BUILD_NAME|BZR_COMMAND|BZR_UPDATE_OPTIONS|CHANGE_ID|CHECKOUT_COMMAND|CONFIGURATION_TYPE|CONFIGURE_COMMAND|COVERAGE_COMMAND|COVERAGE_EXTRA_FLAGS|CURL_OPTIONS|CUSTOM_(?:COVERAGE_EXCLUDE|ERROR_EXCEPTION|ERROR_MATCH|ERROR_POST_CONTEXT|ERROR_PRE_CONTEXT|MAXIMUM_FAILED_TEST_OUTPUT_SIZE|MAXIMUM_NUMBER_OF_(?:ERRORS|WARNINGS)|MAXIMUM_PASSED_TEST_OUTPUT_SIZE|MEMCHECK_IGNORE|POST_MEMCHECK|POST_TEST|PRE_MEMCHECK|PRE_TEST|TESTS_IGNORE|WARNING_EXCEPTION|WARNING_MATCH)|CVS_CHECKOUT|CVS_COMMAND|CVS_UPDATE_OPTIONS|DROP_LOCATION|DROP_METHOD|DROP_SITE|DROP_SITE_CDASH|DROP_SITE_PASSWORD|DROP_SITE_USER|EXTRA_COVERAGE_GLOB|GIT_COMMAND|GIT_INIT_SUBMODULES|GIT_UPDATE_CUSTOM|GIT_UPDATE_OPTIONS|HG_COMMAND|HG_UPDATE_OPTIONS|LABELS_FOR_SUBPROJECTS|MEMORYCHECK_(?:COMMAND|COMMAND_OPTIONS|SANITIZER_OPTIONS|SUPPRESSIONS_FILE|TYPE)|NIGHTLY_START_TIME|P4_CLIENT|P4_COMMAND|P4_OPTIONS|P4_UPDATE_OPTIONS|RUN_CURRENT_SCRIPT|SCP_COMMAND|SITE|SOURCE_DIRECTORY|SUBMIT_URL|SVN_COMMAND|SVN_OPTIONS|SVN_UPDATE_OPTIONS|TEST_LOAD|TEST_TIMEOUT|TRIGGER_SITE|UPDATE_COMMAND|UPDATE_OPTIONS|UPDATE_VERSION_ONLY|USE_LAUNCHERS)|CYGWIN|ENV|EXECUTABLE_OUTPUT_PATH|GHS-MULTI|IOS|LIBRARY_OUTPUT_PATH|MINGW|MSVC(?:10|11|12|14|60|70|71|80|90|_IDE|_TOOLSET_VERSION|_VERSION)?|MSYS|PROJECT_(?:BINARY_DIR|DESCRIPTION|HOMEPAGE_URL|NAME|SOURCE_DIR|VERSION|VERSION_(?:MAJOR|MINOR|PATCH|TWEAK))|UNIX|WIN32|WINCE|WINDOWS_PHONE|WINDOWS_STORE|XCODE|XCODE_VERSION))\b/,
+ 'property': /\b(?:cxx_\w+|(?:ARCHIVE_OUTPUT_(?:DIRECTORY|NAME)|COMPILE_DEFINITIONS|COMPILE_PDB_NAME|COMPILE_PDB_OUTPUT_DIRECTORY|EXCLUDE_FROM_DEFAULT_BUILD|IMPORTED_(?:IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_LANGUAGES|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|NO_SONAME|OBJECTS|SONAME)|INTERPROCEDURAL_OPTIMIZATION|LIBRARY_OUTPUT_DIRECTORY|LIBRARY_OUTPUT_NAME|LINK_FLAGS|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|MAP_IMPORTED_CONFIG|OSX_ARCHITECTURES|OUTPUT_NAME|PDB_NAME|PDB_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_NAME|STATIC_LIBRARY_FLAGS|VS_CSHARP|VS_DOTNET_REFERENCEPROP|VS_DOTNET_REFERENCE|VS_GLOBAL_SECTION_POST|VS_GLOBAL_SECTION_PRE|VS_GLOBAL|XCODE_ATTRIBUTE)_\w+|\w+_(?:CLANG_TIDY|COMPILER_LAUNCHER|CPPCHECK|CPPLINT|INCLUDE_WHAT_YOU_USE|OUTPUT_NAME|POSTFIX|VISIBILITY_PRESET)|ABSTRACT|ADDITIONAL_MAKE_CLEAN_FILES|ADVANCED|ALIASED_TARGET|ALLOW_DUPLICATE_CUSTOM_TARGETS|ANDROID_(?:ANT_ADDITIONAL_OPTIONS|API|API_MIN|ARCH|ASSETS_DIRECTORIES|GUI|JAR_DEPENDENCIES|NATIVE_LIB_DEPENDENCIES|NATIVE_LIB_DIRECTORIES|PROCESS_MAX|PROGUARD|PROGUARD_CONFIG_PATH|SECURE_PROPS_PATH|SKIP_ANT_STEP|STL_TYPE)|ARCHIVE_OUTPUT_DIRECTORY|ARCHIVE_OUTPUT_NAME|ATTACHED_FILES|ATTACHED_FILES_ON_FAIL|AUTOGEN_(?:BUILD_DIR|ORIGIN_DEPENDS|PARALLEL|SOURCE_GROUP|TARGETS_FOLDER|TARGET_DEPENDS)|AUTOMOC|AUTOMOC_(?:COMPILER_PREDEFINES|DEPEND_FILTERS|EXECUTABLE|MACRO_NAMES|MOC_OPTIONS|SOURCE_GROUP|TARGETS_FOLDER)|AUTORCC|AUTORCC_EXECUTABLE|AUTORCC_OPTIONS|AUTORCC_SOURCE_GROUP|AUTOUIC|AUTOUIC_EXECUTABLE|AUTOUIC_OPTIONS|AUTOUIC_SEARCH_PATHS|BINARY_DIR|BUILDSYSTEM_TARGETS|BUILD_RPATH|BUILD_RPATH_USE_ORIGIN|BUILD_WITH_INSTALL_NAME_DIR|BUILD_WITH_INSTALL_RPATH|BUNDLE|BUNDLE_EXTENSION|CACHE_VARIABLES|CLEAN_NO_CUSTOM|COMMON_LANGUAGE_RUNTIME|COMPATIBLE_INTERFACE_(?:BOOL|NUMBER_MAX|NUMBER_MIN|STRING)|COMPILE_(?:DEFINITIONS|FEATURES|FLAGS|OPTIONS|PDB_NAME|PDB_OUTPUT_DIRECTORY)|COST|CPACK_DESKTOP_SHORTCUTS|CPACK_NEVER_OVERWRITE|CPACK_PERMANENT|CPACK_STARTUP_SHORTCUTS|CPACK_START_MENU_SHORTCUTS|CPACK_WIX_ACL|CROSSCOMPILING_EMULATOR|CUDA_EXTENSIONS|CUDA_PTX_COMPILATION|CUDA_RESOLVE_DEVICE_SYMBOLS|CUDA_SEPARABLE_COMPILATION|CUDA_STANDARD|CUDA_STANDARD_REQUIRED|CXX_EXTENSIONS|CXX_STANDARD|CXX_STANDARD_REQUIRED|C_EXTENSIONS|C_STANDARD|C_STANDARD_REQUIRED|DEBUG_CONFIGURATIONS|DEBUG_POSTFIX|DEFINE_SYMBOL|DEFINITIONS|DEPENDS|DEPLOYMENT_ADDITIONAL_FILES|DEPLOYMENT_REMOTE_DIRECTORY|DISABLED|DISABLED_FEATURES|ECLIPSE_EXTRA_CPROJECT_CONTENTS|ECLIPSE_EXTRA_NATURES|ENABLED_FEATURES|ENABLED_LANGUAGES|ENABLE_EXPORTS|ENVIRONMENT|EXCLUDE_FROM_ALL|EXCLUDE_FROM_DEFAULT_BUILD|EXPORT_NAME|EXPORT_PROPERTIES|EXTERNAL_OBJECT|EchoString|FAIL_REGULAR_EXPRESSION|FIND_LIBRARY_USE_LIB32_PATHS|FIND_LIBRARY_USE_LIB64_PATHS|FIND_LIBRARY_USE_LIBX32_PATHS|FIND_LIBRARY_USE_OPENBSD_VERSIONING|FIXTURES_CLEANUP|FIXTURES_REQUIRED|FIXTURES_SETUP|FOLDER|FRAMEWORK|Fortran_FORMAT|Fortran_MODULE_DIRECTORY|GENERATED|GENERATOR_FILE_NAME|GENERATOR_IS_MULTI_CONFIG|GHS_INTEGRITY_APP|GHS_NO_SOURCE_GROUP_FILE|GLOBAL_DEPENDS_DEBUG_MODE|GLOBAL_DEPENDS_NO_CYCLES|GNUtoMS|HAS_CXX|HEADER_FILE_ONLY|HELPSTRING|IMPLICIT_DEPENDS_INCLUDE_TRANSFORM|IMPORTED|IMPORTED_(?:COMMON_LANGUAGE_RUNTIME|CONFIGURATIONS|GLOBAL|IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_(?:LANGUAGES|LIBRARIES|MULTIPLICITY)|LOCATION|NO_SONAME|OBJECTS|SONAME)|IMPORT_PREFIX|IMPORT_SUFFIX|INCLUDE_DIRECTORIES|INCLUDE_REGULAR_EXPRESSION|INSTALL_NAME_DIR|INSTALL_RPATH|INSTALL_RPATH_USE_LINK_PATH|INTERFACE_(?:AUTOUIC_OPTIONS|COMPILE_DEFINITIONS|COMPILE_FEATURES|COMPILE_OPTIONS|INCLUDE_DIRECTORIES|LINK_DEPENDS|LINK_DIRECTORIES|LINK_LIBRARIES|LINK_OPTIONS|POSITION_INDEPENDENT_CODE|SOURCES|SYSTEM_INCLUDE_DIRECTORIES)|INTERPROCEDURAL_OPTIMIZATION|IN_TRY_COMPILE|IOS_INSTALL_COMBINED|JOB_POOLS|JOB_POOL_COMPILE|JOB_POOL_LINK|KEEP_EXTENSION|LABELS|LANGUAGE|LIBRARY_OUTPUT_DIRECTORY|LIBRARY_OUTPUT_NAME|LINKER_LANGUAGE|LINK_(?:DEPENDS|DEPENDS_NO_SHARED|DIRECTORIES|FLAGS|INTERFACE_LIBRARIES|INTERFACE_MULTIPLICITY|LIBRARIES|OPTIONS|SEARCH_END_STATIC|SEARCH_START_STATIC|WHAT_YOU_USE)|LISTFILE_STACK|LOCATION|MACOSX_BUNDLE|MACOSX_BUNDLE_INFO_PLIST|MACOSX_FRAMEWORK_INFO_PLIST|MACOSX_PACKAGE_LOCATION|MACOSX_RPATH|MACROS|MANUALLY_ADDED_DEPENDENCIES|MEASUREMENT|MODIFIED|NAME|NO_SONAME|NO_SYSTEM_FROM_IMPORTED|OBJECT_DEPENDS|OBJECT_OUTPUTS|OSX_ARCHITECTURES|OUTPUT_NAME|PACKAGES_FOUND|PACKAGES_NOT_FOUND|PARENT_DIRECTORY|PASS_REGULAR_EXPRESSION|PDB_NAME|PDB_OUTPUT_DIRECTORY|POSITION_INDEPENDENT_CODE|POST_INSTALL_SCRIPT|PREDEFINED_TARGETS_FOLDER|PREFIX|PRE_INSTALL_SCRIPT|PRIVATE_HEADER|PROCESSORS|PROCESSOR_AFFINITY|PROJECT_LABEL|PUBLIC_HEADER|REPORT_UNDEFINED_PROPERTIES|REQUIRED_FILES|RESOURCE|RESOURCE_LOCK|RULE_LAUNCH_COMPILE|RULE_LAUNCH_CUSTOM|RULE_LAUNCH_LINK|RULE_MESSAGES|RUNTIME_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_NAME|RUN_SERIAL|SKIP_AUTOGEN|SKIP_AUTOMOC|SKIP_AUTORCC|SKIP_AUTOUIC|SKIP_BUILD_RPATH|SKIP_RETURN_CODE|SOURCES|SOURCE_DIR|SOVERSION|STATIC_LIBRARY_FLAGS|STATIC_LIBRARY_OPTIONS|STRINGS|SUBDIRECTORIES|SUFFIX|SYMBOLIC|TARGET_ARCHIVES_MAY_BE_SHARED_LIBS|TARGET_MESSAGES|TARGET_SUPPORTS_SHARED_LIBS|TESTS|TEST_INCLUDE_FILE|TEST_INCLUDE_FILES|TIMEOUT|TIMEOUT_AFTER_MATCH|TYPE|USE_FOLDERS|VALUE|VARIABLES|VERSION|VISIBILITY_INLINES_HIDDEN|VS_(?:CONFIGURATION_TYPE|COPY_TO_OUT_DIR|DEBUGGER_(?:COMMAND|COMMAND_ARGUMENTS|ENVIRONMENT|WORKING_DIRECTORY)|DEPLOYMENT_CONTENT|DEPLOYMENT_LOCATION|DOTNET_REFERENCES|DOTNET_REFERENCES_COPY_LOCAL|GLOBAL_KEYWORD|GLOBAL_PROJECT_TYPES|GLOBAL_ROOTNAMESPACE|INCLUDE_IN_VSIX|IOT_STARTUP_TASK|KEYWORD|RESOURCE_GENERATOR|SCC_AUXPATH|SCC_LOCALPATH|SCC_PROJECTNAME|SCC_PROVIDER|SDK_REFERENCES|SHADER_(?:DISABLE_OPTIMIZATIONS|ENABLE_DEBUG|ENTRYPOINT|FLAGS|MODEL|OBJECT_FILE_NAME|OUTPUT_HEADER_FILE|TYPE|VARIABLE_NAME)|STARTUP_PROJECT|TOOL_OVERRIDE|USER_PROPS|WINRT_COMPONENT|WINRT_EXTENSIONS|WINRT_REFERENCES|XAML_TYPE)|WILL_FAIL|WIN32_EXECUTABLE|WINDOWS_EXPORT_ALL_SYMBOLS|WORKING_DIRECTORY|WRAP_EXCLUDE|XCODE_(?:EMIT_EFFECTIVE_PLATFORM_NAME|EXPLICIT_FILE_TYPE|FILE_ATTRIBUTES|LAST_KNOWN_FILE_TYPE|PRODUCT_TYPE|SCHEME_(?:ADDRESS_SANITIZER|ADDRESS_SANITIZER_USE_AFTER_RETURN|ARGUMENTS|DISABLE_MAIN_THREAD_CHECKER|DYNAMIC_LIBRARY_LOADS|DYNAMIC_LINKER_API_USAGE|ENVIRONMENT|EXECUTABLE|GUARD_MALLOC|MAIN_THREAD_CHECKER_STOP|MALLOC_GUARD_EDGES|MALLOC_SCRIBBLE|MALLOC_STACK|THREAD_SANITIZER(?:_STOP)?|UNDEFINED_BEHAVIOUR_SANITIZER(?:_STOP)?|ZOMBIE_OBJECTS))|XCTEST)\b/,
+ 'keyword': /\b(?:add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|break|build_command|build_name|cmake_host_system_information|cmake_minimum_required|cmake_parse_arguments|cmake_policy|configure_file|continue|create_test_sourcelist|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload|define_property|else|elseif|enable_language|enable_testing|endforeach|endfunction|endif|endmacro|endwhile|exec_program|execute_process|export|export_library_dependencies|file|find_file|find_library|find_package|find_path|find_program|fltk_wrap_ui|foreach|function|get_cmake_property|get_directory_property|get_filename_component|get_property|get_source_file_property|get_target_property|get_test_property|if|include|include_directories|include_external_msproject|include_guard|include_regular_expression|install|install_files|install_programs|install_targets|link_directories|link_libraries|list|load_cache|load_command|macro|make_directory|mark_as_advanced|math|message|option|output_required_files|project|qt_wrap_cpp|qt_wrap_ui|remove|remove_definitions|return|separate_arguments|set|set_directory_properties|set_property|set_source_files_properties|set_target_properties|set_tests_properties|site_name|source_group|string|subdir_depends|subdirs|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_sources|try_compile|try_run|unset|use_mangled_mesa|utility_source|variable_requires|variable_watch|while|write_file)(?=\s*\()\b/,
+ 'boolean': /\b(?:ON|OFF|TRUE|FALSE)\b/,
+ 'namespace': /\b(?:PROPERTIES|SHARED|PRIVATE|STATIC|PUBLIC|INTERFACE|TARGET_OBJECTS)\b/,
+ 'operator': /\b(?:NOT|AND|OR|MATCHES|LESS|GREATER|EQUAL|STRLESS|STRGREATER|STREQUAL|VERSION_LESS|VERSION_EQUAL|VERSION_GREATER|DEFINED)\b/,
+ 'inserted': {
+ pattern: /\b\w+::\w+\b/,
+ alias: 'class-name'
+ },
+ 'number': /\b\d+(?:\.\d+)*\b/,
+ 'function': /\b[a-z_]\w*(?=\s*\()\b/i,
+ 'punctuation': /[()>}]|\$[<{]/
+};
+
+return Prism; })
\ No newline at end of file
delete Prism.languages.coffeescript['template-string'];
+Prism.languages.coffee = Prism.languages.coffeescript;
}(Prism));
return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-c"], function () {
Prism.languages.cpp = Prism.languages.extend('c', {
- 'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
- 'boolean': /\b(?:true|false)\b/,
- 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
-});
-
-Prism.languages.insertBefore('cpp', 'keyword', {
'class-name': {
- pattern: /(class\s+)\w+/i,
+ pattern: /(\b(?:class|enum|struct)\s+)\w+/,
lookbehind: true
- }
+ },
+ 'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
+ 'number': {
+ pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i,
+ greedy: true
+ },
+ 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
+ 'boolean': /\b(?:true|false)\b/
});
Prism.languages.insertBefore('cpp', 'string', {
}
}
],
- 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i,
+ 'operator': />>=?|<<=?|[-=]>|([-+&|?])\1|~|[-+*/%&|^!=<>]=?/,
+ 'punctuation': /\?\.?|::|[{}[\];(),.:]/
});
Prism.languages.insertBefore('csharp', 'class-name', {
}
});
-Prism.languages.dotnet = Prism.languages.csharp;
+Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
+
return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-css"], function () {
Prism.languages.css.selector = {
- pattern: /[^{}\s][^{}]*(?=\s*\{)/,
+ pattern: Prism.languages.css.selector,
inside: {
'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
- 'pseudo-class': /:[-\w]+(?:\(.*\))?/,
+ 'pseudo-class': /:[-\w]+/,
'class': /\.[-:.\w]+/,
'id': /#[-:.\w]+/,
- 'attribute': /\[[^\]]+\]/
+ 'attribute': {
+ pattern: /\[(?:[^[\]"']|("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1)*\]/,
+ greedy: true,
+ inside: {
+ 'punctuation': /^\[|\]$/,
+ 'case-sensitivity': {
+ pattern: /(\s)[si]$/i,
+ lookbehind: true,
+ alias: 'keyword'
+ },
+ 'namespace': {
+ pattern: /^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\|$/
+ }
+ },
+ 'attribute': {
+ pattern: /^(\s*)[-\w\xA0-\uFFFF]+/,
+ lookbehind: true
+ },
+ 'value': [
+ /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+ {
+ pattern: /(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,
+ lookbehind: true
+ }
+ ],
+ 'operator': /[|~*^$]?=/
+ }
+ },
+ 'n-th': [
+ {
+ pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
+ lookbehind: true,
+ inside: {
+ 'number': /[\dn]+/,
+ 'operator': /[+-]/
+ }
+ },
+ {
+ pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
+ lookbehind: true
+ }
+ ],
+ 'punctuation': /[()]/
}
};
+Prism.languages.insertBefore('css', 'property', {
+ 'variable': {
+ pattern: /(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,
+ lookbehind: true
+ }
+});
+
Prism.languages.insertBefore('css', 'function', {
+ 'operator': {
+ pattern: /(\s)[+\-*\/](?=\s)/,
+ lookbehind: true
+ },
'hexcode': /#[\da-f]{3,8}/i,
'entity': /\\[\da-f]{1,8}/i,
- 'number': /[\d%.]+/
+ 'unit': {
+ pattern: /(\d)(?:%|[a-z]+)/,
+ lookbehind: true
+ },
+ 'number': /-?[\d.]+/
});
+
return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-markup"], function () {
-Prism.languages.css = {
- 'comment': /\/\*[\s\S]*?\*\//,
- 'atrule': {
- pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
- inside: {
- 'rule': /@[\w-]+/
- // See rest below
- }
- },
- 'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
- 'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
- 'string': {
- pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
- 'important': /\B!important\b/i,
- 'function': /[-a-z0-9]+(?=\()/i,
- 'punctuation': /[(){};:]/
-};
+(function (Prism) {
-Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
+ var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
-if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'style': {
- pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
- lookbehind: true,
- inside: Prism.languages.css,
- alias: 'language-css',
+ Prism.languages.css = {
+ 'comment': /\/\*[\s\S]*?\*\//,
+ 'atrule': {
+ pattern: /@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,
+ inside: {
+ 'rule': /@[\w-]+/
+ // See rest below
+ }
+ },
+ 'url': {
+ pattern: RegExp('url\\((?:' + string.source + '|[^\n\r()]*)\\)', 'i'),
+ inside: {
+ 'function': /^url/i,
+ 'punctuation': /^\(|\)$/
+ }
+ },
+ 'selector': RegExp('[^{}\\s](?:[^{};"\']|' + string.source + ')*?(?=\\s*\\{)'),
+ 'string': {
+ pattern: string,
greedy: true
- }
- });
+ },
+ 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
+ 'important': /!important\b/i,
+ 'function': /[-a-z0-9]+(?=\()/i,
+ 'punctuation': /[(){};:,]/
+ };
- Prism.languages.insertBefore('inside', 'attr-value', {
- 'style-attr': {
- pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
- inside: {
- 'attr-name': {
- pattern: /^\s*style/i,
- inside: Prism.languages.markup.tag.inside
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
+
+ var markup = Prism.languages.markup;
+ if (markup) {
+ markup.tag.addInlined('style', 'css');
+
+ Prism.languages.insertBefore('inside', 'attr-value', {
+ 'style-attr': {
+ pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
+ inside: {
+ 'attr-name': {
+ pattern: /^\s*style/i,
+ inside: markup.tag.inside
+ },
+ 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
+ 'attr-value': {
+ pattern: /.+/i,
+ inside: Prism.languages.css
+ }
},
- 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
- 'attr-value': {
- pattern: /.+/i,
- inside: Prism.languages.css
- }
- },
- alias: 'language-css'
- }
- }, Prism.languages.markup.tag);
-}
+ alias: 'language-css'
+ }
+ }, markup.tag);
+ }
+
+}(Prism));
+
return Prism; })
\ No newline at end of file
-define(["prism/prism","prism/components/prism-markup","prism/components/prism-css","prism/components/prism-javascript"], function () {
+define(["prism/prism","prism/components/prism-markup-templating"], function () {
// Django/Jinja2 syntax definition for Prism.js <http://prismjs.com> syntax highlighter.
// Mostly it works OK but can paint code incorrectly on complex html/template tag combinations.
-var _django_template = {
- 'property': {
- pattern: /(?:{{|{%)[\s\S]*?(?:%}|}})/g,
- greedy: true,
- inside: {
- 'string': {
- pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
- greedy: true
- },
- 'keyword': /\b(?:\||load|verbatim|widthratio|ssi|firstof|for|url|ifchanged|csrf_token|lorem|ifnotequal|autoescape|now|templatetag|debug|cycle|ifequal|regroup|comment|filter|endfilter|if|spaceless|with|extends|block|include|else|empty|endif|endfor|as|endblock|endautoescape|endverbatim|trans|endtrans|[Tt]rue|[Ff]alse|[Nn]one|in|is|static|macro|endmacro|call|endcall|set|endset|raw|endraw)\b/,
- 'operator' : /[-+=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
- 'function': /\b(?:_|abs|add|addslashes|attr|batch|callable|capfirst|capitalize|center|count|cut|d|date|default|default_if_none|defined|dictsort|dictsortreversed|divisibleby|e|equalto|escape|escaped|escapejs|even|filesizeformat|first|float|floatformat|force_escape|forceescape|format|get_digit|groupby|indent|int|iriencode|iterable|join|last|length|length_is|linebreaks|linebreaksbr|linenumbers|list|ljust|lower|make_list|map|mapping|number|odd|phone2numeric|pluralize|pprint|random|reject|rejectattr|removetags|replace|reverse|rjust|round|safe|safeseq|sameas|select|selectattr|sequence|slice|slugify|sort|string|stringformat|striptags|sum|time|timesince|timeuntil|title|trim|truncate|truncatechars|truncatechars_html|truncatewords|truncatewords_html|undefined|unordered_list|upper|urlencode|urlize|urlizetrunc|wordcount|wordwrap|xmlattr|yesno)\b/,
- 'important': /\b-?\d+(?:\.\d+)?\b/,
- 'variable': /\b\w+?\b/,
- 'punctuation' : /[[\];(),.:]/
- }
- }
-};
-
-Prism.languages.django = Prism.languages.extend('markup', {'comment': /(?:<!--|{#)[\s\S]*?(?:#}|-->)/});
-// Updated html tag pattern to allow template tags inside html tags
-Prism.languages.django.tag.pattern = /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^>=]+))?)*\s*\/?>/i;
-Prism.languages.insertBefore('django', 'entity', _django_template);
-Prism.languages.insertBefore('inside', 'tag', _django_template, Prism.languages.django.tag);
-
-if (Prism.languages.javascript) {
- // Combine js code and template tags painting inside <script> blocks
- Prism.languages.insertBefore('inside', 'string', _django_template, Prism.languages.django.script);
- Prism.languages.django.script.inside.string.inside = _django_template;
-}
-if (Prism.languages.css) {
- // Combine css code and template tags painting inside <style> blocks
- Prism.languages.insertBefore('inside', 'atrule', {'tag': _django_template.property}, Prism.languages.django.style);
- Prism.languages.django.style.inside.string.inside = _django_template;
-}
-
-// Add an Jinja2 alias
-Prism.languages.jinja2 = Prism.languages.django;
+(function (Prism) {
+
+ Prism.languages.django = {
+ 'comment': /^{#[\s\S]*?#}$/,
+ 'tag': {
+ pattern: /(^{%[+-]?\s*)\w+/,
+ lookbehind: true,
+ alias: 'keyword'
+ },
+ 'delimiter': {
+ pattern: /^{[{%][+-]?|[+-]?[}%]}$/,
+ alias: 'punctuation'
+ },
+ 'string': {
+ pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
+ greedy: true
+ },
+ 'filter': {
+ pattern: /(\|)\w+/,
+ lookbehind: true,
+ alias: 'function'
+ },
+ 'test': {
+ pattern: /(\bis\s+(?:not\s+)?)(?!not\b)\w+/,
+ lookbehind: true,
+ alias: 'function'
+ },
+ 'function': /\b[a-z_]\w+(?=\s*\()/i,
+ 'keyword': /\b(?:and|as|by|else|for|if|import|in|is|loop|not|or|recursive|with|without)\b/,
+ 'operator': /[-+*/%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
+ 'number': /\b\d+(?:\.\d+)?\b/,
+ 'boolean': /[Tt]rue|[Ff]alse|[Nn]one/,
+ 'variable': /\b\w+?\b/,
+ 'punctuation': /[{}[\](),.:;]/
+ };
+
+
+ var pattern = /{{[\s\S]*?}}|{%[\s\S]*?%}|{#[\s\S]*?#}/g;
+ var markupTemplating = Prism.languages['markup-templating'];
+
+ Prism.hooks.add('before-tokenize', function (env) {
+ markupTemplating.buildPlaceholders(env, 'django', pattern);
+ });
+ Prism.hooks.add('after-tokenize', function (env) {
+ markupTemplating.tokenizePlaceholders(env, 'django');
+ });
+
+ // Add an Jinja2 alias
+ Prism.languages.jinja2 = Prism.languages.django;
+ Prism.hooks.add('before-tokenize', function (env) {
+ markupTemplating.buildPlaceholders(env, 'jinja2', pattern);
+ });
+ Prism.hooks.add('after-tokenize', function (env) {
+ markupTemplating.tokenizePlaceholders(env, 'jinja2');
+ });
+
+})(Prism);
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.ebnf = {
+ 'comment': /\(\*[\s\S]*?\*\)/,
+ 'string': {
+ pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
+ greedy: true
+ },
+ 'special': {
+ pattern: /\?[^?\r\n]*\?/,
+ greedy: true,
+ alias: 'class-name'
+ },
+
+ 'definition': {
+ pattern: /^(\s*)[a-z]\w*(?:[ \t]+[a-z]\w*)*(?=\s*=)/im,
+ lookbehind: true,
+ alias: ['rule', 'keyword']
+ },
+ 'rule': /[a-z]\w*(?:[ \t]+[a-z]\w*)*/i,
+
+ 'punctuation': /\([:/]|[:/]\)|[.,;()[\]{}]/,
+ 'operator': /[-=|*/!]/
+};
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-javascript","prism/components/prism-markup-templating"], function () {
+(function (Prism) {
+
+ Prism.languages.ejs = {
+ 'delimiter': {
+ pattern: /^<%[-_=]?|[-_]?%>$/,
+ alias: 'punctuation'
+ },
+ 'comment': /^#[\s\S]*/,
+ 'language-javascript': {
+ pattern: /[\s\S]+/,
+ inside: Prism.languages.javascript
+ }
+ };
+
+ Prism.hooks.add('before-tokenize', function(env) {
+ var ejsPattern = /<%(?!%)[\s\S]+?%>/g;
+ Prism.languages['markup-templating'].buildPlaceholders(env, 'ejs', ejsPattern);
+ });
+
+ Prism.hooks.add('after-tokenize', function(env) {
+ Prism.languages['markup-templating'].tokenizePlaceholders(env, 'ejs');
+ });
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
Prism.languages.elixir = {
- 'comment': {
- pattern: /#.*/m,
- lookbehind: true
- },
+ 'comment': /#.*/m,
// ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
'regex': {
pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,
};
});
-
return Prism; })
\ No newline at end of file
});
Prism.hooks.add('before-tokenize', function(env) {
- var erbPattern = /<%=?[\s\S]+?%>/g;
+ var erbPattern = /<%=?(?:[^\r\n]|[\r\n](?!=begin)|[\r\n]=begin\s[\s\S]*?^=end)+?%>/gm;
Prism.languages['markup-templating'].buildPlaceholders(env, 'erb', erbPattern);
});
});
}(Prism));
+
return Prism; })
\ No newline at end of file
]
});
Prism.languages.flow['function-variable'].pattern = /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i;
+ delete Prism.languages.flow['parameter'];
Prism.languages.insertBefore('flow', 'operator', {
'flow-punctuation': {
}
});
- if (Prism.util.type(Prism.languages.flow.keyword) !== 'Array') {
+ if (!Array.isArray(Prism.languages.flow.keyword)) {
Prism.languages.flow.keyword = [Prism.languages.flow.keyword];
}
Prism.languages.flow.keyword.unshift(
}
);
}(Prism));
+
return Prism; })
\ No newline at end of file
lookbehind: true
}
],
- 'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,
'string': {
pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|"(?:\\[\s\S]|[^\\"])*")B?|'(?:[^\\']|\\.)'B?/,
greedy: true
},
+ 'class-name': {
+ pattern: /(\b(?:exception|inherit|interface|new|of|type)\s+|\w\s*:\s*|\s:\??>\s*)[.\w]+\b(?:\s*(?:->|\*)\s*[.\w]+\b)*(?!\s*[:.])/,
+ lookbehind: true,
+ inside: {
+ 'operator': /->|\*/,
+ 'punctuation': /\./
+ }
+ },
+ 'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,
'number': [
/\b0x[\da-fA-F]+(?:un|lf|LF)?\b/,
/\b0b[01]+(?:y|uy)?\b/,
/(?:\b\d+\.?\d*|\B\.\d+)(?:[fm]|e[+-]?\d+)?\b/i,
/\b\d+(?:[IlLsy]|u[lsy]?|UL)?\b/
- ]
+ ],
+ 'operator': /([<>~&^])\1\1|([*.:<>&])\2|<-|->|[!=:]=|<?\|{1,3}>?|\??(?:<=|>=|<>|[-+*/%=<>])\??|[!?^&]|~[+~-]|:>|:\?>?/
});
Prism.languages.insertBefore('fsharp', 'keyword', {
'preprocessor': {
}
}
});
+Prism.languages.insertBefore('fsharp', 'punctuation', {
+ 'computation-expression': {
+ pattern: /[_a-z]\w*(?=\s*\{)/i,
+ alias: 'keyword'
+ }
+});
+Prism.languages.insertBefore('fsharp', 'string', {
+ 'annotation': {
+ pattern: /\[<.+?>\]/,
+ inside: {
+ 'punctuation': /^\[<|>\]$/,
+ 'class-name': {
+ pattern: /^\w+$|(^|;\s*)[A-Z]\w*(?=\()/,
+ lookbehind: true
+ },
+ 'annotation-content': {
+ pattern: /[\s\S]+/,
+ inside: Prism.languages.fsharp
+ }
+ }
+ }
+});
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.gcode = {
+ 'comment': /;.*|\B\(.*?\)\B/,
+ 'string': {
+ pattern: /"(?:""|[^"])*"/,
+ greedy: true
+ },
+ 'keyword': /\b[GM]\d+(?:\.\d+)?\b/,
+ 'property': /\b[A-Z]/,
+ 'checksum': {
+ pattern: /\*\d+/,
+ alias: 'punctuation'
+ },
+ // T0:0:0
+ 'punctuation': /:/
+};
+
+return Prism; })
\ No newline at end of file
pattern: /@[a-z_]\w*/i,
alias: 'function'
},
- 'attr-name': /[a-z_]\w*(?=\s*:)/i,
- 'keyword': [
- {
- pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.{3}\s*)on\b/,
- lookbehind: true
- },
- /\b(?:query|fragment|mutation)\b/
- ],
- 'operator': /!|=|\.{3}/,
- 'punctuation': /[!(){}\[\]:=,]/
+ 'attr-name': {
+ pattern: /[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
+ greedy: true
+ },
+ 'class-name': {
+ pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+)[a-zA-Z_]\w*/,
+ lookbehind: true
+ },
+ 'fragment': {
+ pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
+ lookbehind: true,
+ alias: 'function'
+ },
+ 'keyword': /\b(?:enum|fragment|implements|input|interface|mutation|on|query|scalar|schema|type|union)\b/,
+ 'operator': /[!=|]|\.{3}/,
+ 'punctuation': /[!(){}\[\]:=,]/,
+ 'constant': /\b(?!ID\b)[A-Z][A-Z_\d]*\b/
};
+
return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
-Prism.languages.haskell= {
+Prism.languages.haskell = {
'comment': {
pattern: /(^|[^-!#$%*+=?&@|~.:<>^\\\/])(?:--[^-!#$%*+=?&@|~.:<>^\\\/].*|{-[\s\S]*?-})/m,
lookbehind: true
pattern: /"(?:[^\\"]|\\(?:[abfnrtv\\"'&]|\^[A-Z@[\]^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+)|\\\s+\\)*"/,
greedy: true
},
- 'keyword' : /\b(?:case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/,
- 'import_statement' : {
+ 'keyword': /\b(?:case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/,
+ 'import_statement': {
// The imported or hidden names are not included in this import
// statement. This is because we want to highlight those exactly like
// we do for the names in the program.
// These are builtin variables only. Constructors are highlighted later as a constant.
'builtin': /\b(?:abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b/,
// decimal integers and floating point numbers | octal integers | hexadecimal integers
- 'number' : /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0o[0-7]+|0x[0-9a-f]+)\b/i,
+ 'number': /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0o[0-7]+|0x[0-9a-f]+)\b/i,
// Most of this is needed because of the meaning of a single '.'.
// If it stands alone freely, it is the function composition.
// It may also be a separator between a module name and an identifier => no
// operator. If it comes together with other special characters it is an
// operator too.
- 'operator' : /\s\.\s|[-!#$%*+=?&@|~.:<>^\\\/]*\.[-!#$%*+=?&@|~.:<>^\\\/]+|[-!#$%*+=?&@|~.:<>^\\\/]+\.[-!#$%*+=?&@|~.:<>^\\\/]*|[-!#$%*+=?&@|~:<>^\\\/]+|`([A-Z][\w']*\.)*[_a-z][\w']*`/,
+ 'operator': /\s\.\s|[-!#$%*+=?&@|~.:<>^\\\/]*\.[-!#$%*+=?&@|~.:<>^\\\/]+|[-!#$%*+=?&@|~.:<>^\\\/]+\.[-!#$%*+=?&@|~.:<>^\\\/]*|[-!#$%*+=?&@|~:<>^\\\/]+|`([A-Z][\w']*\.)*[_a-z][\w']*`/,
// In Haskell, nearly everything is a variable, do not highlight these.
'hvariable': /\b(?:[A-Z][\w']*\.)*[_a-z][\w']*\b/,
'constant': /\b(?:[A-Z][\w']*\.)*[A-Z][\w']*\b/,
- 'punctuation' : /[{}[\];(),.:]/
+ 'punctuation': /[{}[\];(),.:]/
};
+Prism.languages.hs = Prism.languages.haskell;
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.hcl = {
+ 'comment': /(?:\/\/|#).*|\/\*[\s\S]*?(?:\*\/|$)/,
+ 'heredoc': {
+ pattern: /<<-?(\w+)[\s\S]*?^\s*\1/m,
+ greedy: true,
+ alias: 'string'
+ },
+ 'keyword': [
+ {
+ pattern: /(?:resource|data)\s+(?:"(?:\\[\s\S]|[^\\"])*")(?=\s+"[\w-]+"\s+{)/i,
+ inside: {
+ 'type': {
+ pattern: /(resource|data|\s+)(?:"(?:\\[\s\S]|[^\\"])*")/i,
+ lookbehind: true,
+ alias: 'variable'
+ }
+ }
+ },
+ {
+ pattern: /(?:provider|provisioner|variable|output|module|backend)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+(?={)/i,
+ inside: {
+ 'type': {
+ pattern: /(provider|provisioner|variable|output|module|backend)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+/i,
+ lookbehind: true,
+ alias: 'variable'
+ }
+ }
+ },
+ {
+ pattern: /[\w-]+(?=\s+{)/
+ }
+ ],
+ 'property': [
+ /[\w-\.]+(?=\s*=(?!=))/,
+ /"(?:\\[\s\S]|[^\\"])+"(?=\s*[:=])/,
+ ],
+ 'string': {
+ pattern: /"(?:[^\\$"]|\\[\s\S]|\$(?:(?=")|\$+|[^"${])|\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\})*"/,
+ greedy: true,
+ inside: {
+ 'interpolation': {
+ pattern: /(^|[^$])\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\}/,
+ lookbehind: true,
+ inside: {
+ 'type': {
+ pattern: /(\b(?:terraform|var|self|count|module|path|data|local)\b\.)[\w\*]+/i,
+ lookbehind: true,
+ alias: 'variable'
+ },
+ 'keyword': /\b(?:terraform|var|self|count|module|path|data|local)\b/i,
+ 'function': /\w+(?=\()/,
+ 'string': {
+ pattern: /"(?:\\[\s\S]|[^\\"])*"/,
+ greedy: true,
+ },
+ 'number': /\b0x[\da-f]+|\d+\.?\d*(?:e[+-]?\d+)?/i,
+ 'punctuation': /[!\$#%&'()*+,.\/;<=>@\[\\\]^`{|}~?:]/,
+ }
+ },
+ }
+ },
+ 'number': /\b0x[\da-f]+|\d+\.?\d*(?:e[+-]?\d+)?/i,
+ 'boolean': /\b(?:true|false)\b/i,
+ 'punctuation': /[=\[\]{}]/,
+};
+
+return Prism; })
\ No newline at end of file
*/
Prism.languages.hpkp = {
- 'directive': {
+ 'directive': {
pattern: /\b(?:(?:includeSubDomains|preload|strict)(?: |;)|pin-sha256="[a-zA-Z\d+=/]+"|(?:max-age|report-uri)=|report-to )/,
alias: 'keyword'
},
alias: 'selector'
},
'unsafe': {
- pattern: /\d{0,6}/,
+ pattern: /\d{1,6}/,
alias: 'function'
}
};
+
return Prism; })
\ No newline at end of file
*/
Prism.languages.hsts = {
- 'directive': {
+ 'directive': {
pattern: /\b(?:max-age=|includeSubDomains|preload)/,
alias: 'keyword'
},
alias: 'selector'
},
'unsafe': {
- pattern: /\d{0,7}/,
+ pattern: /\d{1,7}/,
alias: 'function'
}
};
+
return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-javascript","prism/components/prism-markup"], function () {
-Prism.languages.http = {
- 'request-line': {
- pattern: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\s(?:https?:\/\/|\/)\S+\sHTTP\/[0-9.]+/m,
- inside: {
- // HTTP Verb
- property: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
- // Path or query argument
- 'attr-name': /:\w+/
- }
- },
- 'response-status': {
- pattern: /^HTTP\/1.[01] \d+.*/m,
- inside: {
- // Status, e.g. 200 OK
- property: {
- pattern: /(^HTTP\/1.[01] )\d+.*/i,
- lookbehind: true
- }
+(function (Prism) {
+ Prism.languages.http = {
+ 'request-line': {
+ pattern: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\s(?:https?:\/\/|\/)\S+\sHTTP\/[0-9.]+/m,
+ inside: {
+ // HTTP Verb
+ 'property': /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
+ // Path or query argument
+ 'attr-name': /:\w+/
+ }
+ },
+ 'response-status': {
+ pattern: /^HTTP\/1.[01] \d+.*/m,
+ inside: {
+ // Status, e.g. 200 OK
+ 'property': {
+ pattern: /(^HTTP\/1.[01] )\d+.*/i,
+ lookbehind: true
+ }
+ }
+ },
+ // HTTP header name
+ 'header-name': {
+ pattern: /^[\w-]+:(?=.)/m,
+ alias: 'keyword'
}
- },
- // HTTP header name
- 'header-name': {
- pattern: /^[\w-]+:(?=.)/m,
- alias: 'keyword'
- }
-};
+ };
-// Create a mapping of Content-Type headers to language definitions
-var httpLanguages = {
- 'application/json': Prism.languages.javascript,
- 'application/xml': Prism.languages.markup,
- 'text/xml': Prism.languages.markup,
- 'text/html': Prism.languages.markup
-};
+ // Create a mapping of Content-Type headers to language definitions
+ var langs = Prism.languages;
+ var httpLanguages = {
+ 'application/javascript': langs.javascript,
+ 'application/json': langs.json || langs.javascript,
+ 'application/xml': langs.xml,
+ 'text/xml': langs.xml,
+ 'text/html': langs.html,
+ 'text/css': langs.css
+ };
-// Insert each content type parser that has its associated language
-// currently loaded.
-for (var contentType in httpLanguages) {
- if (httpLanguages[contentType]) {
- var options = {};
- options[contentType] = {
- pattern: RegExp('(content-type:\\s*' + contentType + '[\\w\\W]*?)(?:\\r?\\n|\\r){2}[\\w\\W]*', 'i'),
- lookbehind: true,
- inside: {
- rest: httpLanguages[contentType]
- }
- };
+ // Declare which types can also be suffixes
+ var suffixTypes = {
+ 'application/json': true,
+ 'application/xml': true
+ };
+
+ /**
+ * Returns a pattern for the given content type which matches it and any type which has it as a suffix.
+ *
+ * @param {string} contentType
+ * @returns {string}
+ */
+ function getSuffixPattern(contentType) {
+ var suffix = contentType.replace(/^[a-z]+\//, '');
+ var suffixPattern = '\\w+/(?:[\\w.-]+\\+)+' + suffix + '(?![+\\w.-])';
+ return '(?:' + contentType + '|' + suffixPattern + ')';
+ }
+
+ // Insert each content type parser that has its associated language
+ // currently loaded.
+ var options;
+ for (var contentType in httpLanguages) {
+ if (httpLanguages[contentType]) {
+ options = options || {};
+
+ var pattern = suffixTypes[contentType] ? getSuffixPattern(contentType) : contentType;
+ options[contentType] = {
+ pattern: RegExp('(content-type:\\s*' + pattern + '[\\s\\S]*?)(?:\\r?\\n|\\r){2}[\\s\\S]*', 'i'),
+ lookbehind: true,
+ inside: {
+ rest: httpLanguages[contentType]
+ }
+ };
+ }
+ }
+ if (options) {
Prism.languages.insertBefore('http', 'header-name', options);
}
-}
+
+}(Prism));
return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
Prism.languages.ini= {
- 'comment': /^[ \t]*;.*$/m,
+ 'comment': /^[ \t]*[;#].*$/m,
'selector': /^[ \t]*\[.*?\]/m,
'constant': /^[ \t]*[^\s=]+?(?=[ \t]*=)/m,
'attr-value': {
}
}
};
+
return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-clike"], function () {
-Prism.languages.java = Prism.languages.extend('clike', {
- 'keyword': /\b(?:var|abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
- 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp-]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?[df]?/i,
- 'operator': {
- pattern: /(^|[^.])(?:<<=?|>>>?=?|->|([-+&|])\2|[?:~]|[-+*/%&|^!=<>]=?)/m,
- lookbehind: true
- }
-});
+(function (Prism) {
-Prism.languages.insertBefore('java','function', {
- 'annotation': {
- alias: 'punctuation',
- pattern: /(^|[^.])@\w+/,
- lookbehind: true
- }
-});
+ var keywords = /\b(?:abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while|var|null|exports|module|open|opens|provides|requires|to|transitive|uses|with)\b/;
-Prism.languages.insertBefore('java', 'class-name', {
- 'generics': {
- pattern: /<\s*\w+(?:\.\w+)?(?:\s*,\s*\w+(?:\.\w+)?)*>/i,
- alias: 'function',
- inside: {
- keyword: Prism.languages.java.keyword,
- punctuation: /[<>(),.:]/
+ // based on the java naming conventions
+ var className = /\b[A-Z](?:\w*[a-z]\w*)?\b/;
+
+ Prism.languages.java = Prism.languages.extend('clike', {
+ 'class-name': [
+ className,
+
+ // variables and parameters
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
+ /\b[A-Z]\w*(?=\s+\w+\s*[;,=())])/
+ ],
+ 'keyword': keywords,
+ 'function': [
+ Prism.languages.clike.function,
+ {
+ pattern: /(\:\:)[a-z_]\w*/,
+ lookbehind: true
+ }
+ ],
+ 'number': /\b0b[01][01_]*L?\b|\b0x[\da-f_]*\.?[\da-f_p+-]+\b|(?:\b\d[\d_]*\.?[\d_]*|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
+ 'operator': {
+ pattern: /(^|[^.])(?:<<=?|>>>?=?|->|([-+&|])\2|[?:~]|[-+*/%&|^!=<>]=?)/m,
+ lookbehind: true
+ }
+ });
+
+ Prism.languages.insertBefore('java', 'class-name', {
+ 'annotation': {
+ alias: 'punctuation',
+ pattern: /(^|[^.])@\w+/,
+ lookbehind: true
+ },
+ 'namespace': {
+ pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(\.[a-z]\w*)+/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\./,
+ }
+ },
+ 'generics': {
+ pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,
+ inside: {
+ 'class-name': className,
+ 'keyword': keywords,
+ 'punctuation': /[<>(),.:]/,
+ 'operator': /[?&|]/
+ }
}
- }
-});
+ });
+}(Prism));
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-markup","prism/components/prism-java","prism/components/prism-javadoclike","prism/components/prism-scala"], function () {
+(function (Prism) {
+
+ var codeLines = {
+ 'code': {
+ pattern: /(^(\s*(?:\*\s*)*)).*[^*\s].+$/m,
+ lookbehind: true,
+ inside: Prism.languages.java,
+ alias: 'language-java'
+ }
+ };
+
+ Prism.languages.javadoc = Prism.languages.extend('javadoclike', {});
+ Prism.languages.insertBefore('javadoc', 'keyword', {
+ 'class-name': [
+ {
+ pattern: /(@(?:exception|throws|see|link|linkplain|value)\s+(?:[a-z\d]+\.)*)[A-Z](?:\w*[a-z]\w*)?(?:\.[A-Z](?:\w*[a-z]\w*)?)*/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\./
+ }
+ },
+ {
+ // @param <T> the first generic type parameter
+ pattern: /(@param\s+)<[A-Z]\w*>/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /[.<>]/
+ }
+ }
+ ],
+ 'namespace': {
+ pattern: /(@(?:exception|throws|see|link|linkplain)\s+)(?:[a-z\d]+\.)+/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\./
+ }
+ },
+ 'code-section': [
+ {
+ pattern: /(\{@code\s+)(?:[^{}]|\{[^{}]*\})+?(?=\s*\})/,
+ lookbehind: true,
+ inside: codeLines
+ },
+ {
+ pattern: /(<(code|tt)>\s*)[\s\S]+?(?=\s*<\/\2>)/,
+ lookbehind: true,
+ inside: codeLines
+ }
+ ],
+ 'tag': Prism.languages.markup.tag,
+ });
+
+ Prism.languages.javadoclike.addSupport('java', Prism.languages.javadoc);
+}(Prism));
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-java","prism/components/prism-javascript","prism/components/prism-php"], function () {
+(function (Prism) {
+
+ var javaDocLike = Prism.languages.javadoclike = {
+ 'parameter': {
+ pattern: /(^\s*(?:\/{3}|\*|\/\*\*)\s*@(?:param|arg|arguments)\s+)\w+/m,
+ lookbehind: true
+ },
+ 'keyword': {
+ // keywords are the first word in a line preceded be an `@` or surrounded by curly braces.
+ // @word, {@word}
+ pattern: /(^\s*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,
+ lookbehind: true
+ },
+ 'punctuation': /[{}]/
+ };
+
+
+ /**
+ * Adds doc comment support to the given language and calls a given callback on each doc comment pattern.
+ *
+ * @param {string} lang the language add doc comment support to.
+ * @param {(pattern: {inside: {rest: undefined}}) => void} callback the function called with each doc comment pattern as argument.
+ */
+ function docCommentSupport(lang, callback) {
+ var tokenName = 'doc-comment';
+
+ var grammar = Prism.languages[lang];
+ if (!grammar) {
+ return;
+ }
+ var token = grammar[tokenName];
+
+ if (!token) {
+ // add doc comment: /** */
+ var definition = {};
+ definition[tokenName] = {
+ pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,
+ alias: 'comment'
+ };
+
+ grammar = Prism.languages.insertBefore(lang, 'comment', definition);
+ token = grammar[tokenName];
+ }
+
+ if (token instanceof RegExp) { // convert regex to object
+ token = grammar[tokenName] = { pattern: token };
+ }
+
+ if (Array.isArray(token)) {
+ for (var i = 0, l = token.length; i < l; i++) {
+ if (token[i] instanceof RegExp) {
+ token[i] = { pattern: token[i] };
+ }
+ callback(token[i]);
+ }
+ } else {
+ callback(token);
+ }
+ }
+
+ /**
+ * Adds doc-comment support to the given languages for the given documentation language.
+ *
+ * @param {string[]|string} languages
+ * @param {Object} docLanguage
+ */
+ function addSupport(languages, docLanguage) {
+ if (typeof languages === 'string') {
+ languages = [languages];
+ }
+
+ languages.forEach(function (lang) {
+ docCommentSupport(lang, function (pattern) {
+ if (!pattern.inside) {
+ pattern.inside = {};
+ }
+ pattern.inside.rest = docLanguage;
+ });
+ });
+ }
+
+ Object.defineProperty(javaDocLike, 'addSupport', { value: addSupport });
+
+ javaDocLike.addSupport(['java', 'javascript', 'php'], javaDocLike);
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
pattern: /((?:^|})\s*)(?:catch|finally)\b/,
lookbehind: true
},
- /\b(?:as|async|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/
+ {
+ pattern: /(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
+ lookbehind: true
+ },
],
- 'number': /\b(?:(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\d+n|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
+ 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
- 'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\(|\.(?:apply|bind|call)\()/,
+ 'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
});
-Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/
+Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
Prism.languages.insertBefore('javascript', 'keyword', {
'regex': {
- pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,
+ pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,
lookbehind: true,
greedy: true
},
// This must be declared before keyword because we use "function" inside the look-forward
'function-variable': {
- pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,
+ pattern: /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,
alias: 'function'
},
- 'constant': /\b[A-Z][A-Z\d_]*\b/
+ 'parameter': [
+ {
+ pattern: /(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,
+ lookbehind: true,
+ inside: Prism.languages.javascript
+ },
+ {
+ pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,
+ inside: Prism.languages.javascript
+ },
+ {
+ pattern: /(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,
+ lookbehind: true,
+ inside: Prism.languages.javascript
+ },
+ {
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,
+ lookbehind: true,
+ inside: Prism.languages.javascript
+ }
+ ],
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
});
Prism.languages.insertBefore('javascript', 'string', {
'template-string': {
- pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,
+ pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|[^\\`])*`/,
greedy: true,
inside: {
'interpolation': {
- pattern: /\${[^}]+}/,
+ pattern: /\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,
inside: {
'interpolation-punctuation': {
pattern: /^\${|}$/,
});
if (Prism.languages.markup) {
- Prism.languages.insertBefore('markup', 'tag', {
- 'script': {
- pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
- lookbehind: true,
- inside: Prism.languages.javascript,
- alias: 'language-javascript',
- greedy: true
- }
- });
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
}
Prism.languages.js = Prism.languages.javascript;
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.javastacktrace = {
+
+ // java.sql.SQLException: Violation of unique constraint MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement [...]
+ // Caused by: java.sql.SQLException: Violation of unique constraint MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement [...]
+ // Caused by: com.example.myproject.MyProjectServletException
+ // Caused by: MidLevelException: LowLevelException
+ // Suppressed: Resource$CloseFailException: Resource ID = 0
+ 'summary': {
+ pattern: /^[\t ]*(?:(?:Caused by:|Suppressed:|Exception in thread "[^"]*")[\t ]+)?[\w$.]+(?:\:.*)?$/m,
+ inside: {
+ 'keyword': {
+ pattern: /^(\s*)(?:(?:Caused by|Suppressed)(?=:)|Exception in thread)/m,
+ lookbehind: true
+ },
+
+ // the current thread if the summary starts with 'Exception in thread'
+ 'string': {
+ pattern: /^(\s*)"[^"]*"/,
+ lookbehind: true
+ },
+ 'exceptions': {
+ pattern: /^(:?\s*)[\w$.]+(?=:|$)/,
+ lookbehind: true,
+ inside: {
+ 'class-name': /[\w$]+(?=$|:)/,
+ 'namespace': /[a-z]\w*/,
+ 'punctuation': /[.:]/
+ }
+ },
+ 'message': {
+ pattern: /(:\s*)\S.*/,
+ lookbehind: true,
+ alias: 'string'
+ },
+ 'punctuation': /[:]/
+ }
+ },
+
+ // at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
+ // at org.hsqldb.jdbc.Util.throwError(Unknown Source) here could be some notes
+ // at Util.<init>(Unknown Source)
+ 'stack-frame': {
+ pattern: /^[\t ]*at [\w$.]+(?:<init>)?\([^()]*\)/m,
+ inside: {
+ 'keyword': {
+ pattern: /^(\s*)at/,
+ lookbehind: true
+ },
+ 'source': [
+ // (Main.java:15)
+ // (Main.scala:15)
+ {
+ pattern: /(\()\w+.\w+:\d+(?=\))/,
+ lookbehind: true,
+ inside: {
+ 'file': /^\w+\.\w+/,
+ 'punctuation': /:/,
+ 'line-number': {
+ pattern: /\d+/,
+ alias: 'number'
+ }
+ }
+ },
+ // (Unknown Source)
+ // (Native Method)
+ // (...something...)
+ {
+ pattern: /(\()[^()]*(?=\))/,
+ lookbehind: true,
+ inside: {
+ 'keyword': /^(?:Unknown Source|Native Method)$/
+ }
+ }
+ ],
+ 'class-name': /[\w$]+(?=\.(?:<init>|[\w$]+)\()/,
+ 'function': /(?:<init>|[\w$]+)(?=\()/,
+ 'namespace': /[a-z]\w*/,
+ 'punctuation': /[.()]/
+ }
+ },
+
+ // ... 32 more
+ // ... 32 common frames omitted
+ 'more': {
+ pattern: /^[\t ]*\.{3} \d+ [a-z]+(?: [a-z]+)*/m,
+ inside: {
+ 'punctuation': /\.{3}/,
+ 'number': /\d+/,
+ 'keyword': /\b[a-z]+(?: [a-z]+)*\b/
+ }
+ }
+
+};
+
+return Prism; })
\ No newline at end of file
});
delete Prism.languages.jolie['class-name'];
-delete Prism.languages.jolie['function'];
Prism.languages.insertBefore( 'jolie', 'keyword', {
'function':
--- /dev/null
+define(["prism/prism"], function () {
+(function (Prism) {
+
+ var interpolation = /\\\((?:[^()]|\([^()]*\))*\)/.source;
+ var string = RegExp(/"(?:[^"\r\n\\]|\\[^\r\n(]|__)*"/.source.replace(/__/g, interpolation));
+ var stringInterpolation = {
+ 'interpolation': {
+ pattern: RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + interpolation),
+ lookbehind: true,
+ inside: {
+ 'content': {
+ pattern: /^(\\\()[\s\S]+(?=\)$)/,
+ lookbehind: true,
+ inside: null // see below
+ },
+ 'punctuation': /^\\\(|\)$/
+ }
+ }
+ };
+
+ var jq = Prism.languages.jq = {
+ 'comment': /#.*/,
+ 'property': {
+ pattern: RegExp(string.source + /(?=\s*:(?!:))/.source),
+ greedy: true,
+ inside: stringInterpolation
+ },
+ 'string': {
+ pattern: string,
+ greedy: true,
+ inside: stringInterpolation
+ },
+
+ 'function': {
+ pattern: /(\bdef\s+)[a-z_]\w+/i,
+ lookbehind: true
+ },
+
+ 'variable': /\B\$\w+/,
+ 'property-literal': {
+ pattern: /[a-z_]\w*(?=\s*:(?!:))/i,
+ alias: 'property'
+ },
+ 'keyword': /\b(?:as|break|catch|def|elif|else|end|foreach|if|import|include|label|module|modulemeta|null|reduce|then|try|while)\b/,
+ 'boolean': /\b(?:true|false)\b/,
+ 'number': /(?:\b\d+\.|\B\.)?\d+(?:[eE][+-]?\d+)?\b/,
+
+ 'operator': [
+ {
+ pattern: /\|=?/,
+ alias: 'pipe'
+ },
+ /\.\.|[!=<>]?=|\?\/\/|\/\/=?|[-+*/%]=?|[<>?]|\b(?:and|or|not)\b/
+ ],
+ 'c-style-function': {
+ pattern: /\b[a-z_]\w*(?=\s*\()/i,
+ alias: 'function'
+ },
+ 'punctuation': /::|[()\[\]{},:;]|\.(?=\s*[\[\w$])/,
+ 'dot': {
+ pattern: /\./,
+ alias: 'important'
+ }
+ }
+
+ stringInterpolation.interpolation.inside.content.inside = jq;
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-javascript","prism/components/prism-actionscript","prism/components/prism-coffeescript","prism/components/prism-flow","prism/components/prism-n4js","prism/components/prism-typescript"], function () {
+(function (Prism) {
+
+ Prism.languages.insertBefore('javascript', 'function-variable', {
+ 'method-variable': {
+ pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function-variable'].pattern.source),
+ lookbehind: true,
+ alias: ['function-variable', 'method', 'function', 'property-access']
+ }
+ });
+
+ Prism.languages.insertBefore('javascript', 'function', {
+ 'method': {
+ pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function'].source),
+ lookbehind: true,
+ alias: ['function', 'property-access']
+ }
+ });
+
+ Prism.languages.insertBefore('javascript', 'constant', {
+ 'known-class-name': [
+ {
+ // standard built-ins
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
+ pattern: /\b(?:(?:(?:Uint|Int)(?:8|16|32)|Uint8Clamped|Float(?:32|64))?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|(?:Weak)?(?:Set|Map)|WebAssembly)\b/,
+ alias: 'class-name'
+ },
+ {
+ // errors
+ pattern: /\b(?:[A-Z]\w*)Error\b/,
+ alias: 'class-name'
+ }
+ ]
+ });
+
+ Prism.languages.javascript['keyword'].unshift(
+ {
+ pattern: /\b(?:as|default|export|from|import)\b/,
+ alias: 'module'
+ },
+ {
+ pattern: /\bnull\b/,
+ alias: ['null', 'nil']
+ },
+ {
+ pattern: /\bundefined\b/,
+ alias: 'nil'
+ }
+ );
+
+ Prism.languages.insertBefore('javascript', 'operator', {
+ 'spread': {
+ pattern: /\.{3}/,
+ alias: 'operator'
+ },
+ 'arrow': {
+ pattern: /=>/,
+ alias: 'operator'
+ }
+ });
+
+ Prism.languages.insertBefore('javascript', 'punctuation', {
+ 'property-access': {
+ pattern: /(\.\s*)[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*/,
+ lookbehind: true
+ },
+ 'maybe-class-name': {
+ pattern: /(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,
+ lookbehind: true
+ },
+ 'dom': {
+ // this contains only a few commonly used DOM variables
+ pattern: /\b(?:document|location|navigator|performance|(?:local|session)Storage|window)\b/,
+ alias: 'variable'
+ },
+ 'console': {
+ pattern: /\bconsole(?=\s*\.)/,
+ alias: 'class-name'
+ }
+ });
+
+
+ // add 'maybe-class-name' to tokens which might be a class name
+ var maybeClassNameTokens = ['function', 'function-variable', 'method', 'method-variable', 'property-access'];
+
+ for (var i = 0; i < maybeClassNameTokens.length; i++) {
+ var token = maybeClassNameTokens[i];
+ var value = Prism.languages.javascript[token];
+
+ // convert regex to object
+ if (Prism.util.type(value) === 'RegExp') {
+ value = Prism.languages.javascript[token] = {
+ pattern: value
+ };
+ }
+
+ // keep in mind that we don't support arrays
+
+ var inside = value.inside || {};
+ value.inside = inside;
+
+ inside['maybe-class-name'] = /^[A-Z][\s\S]*/;
+ }
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-javascript","prism/components/prism-javadoclike","prism/components/prism-actionscript","prism/components/prism-coffeescript"], function () {
+(function (Prism) {
+
+ var javascript = Prism.languages.javascript;
+
+ var type = /{(?:[^{}]|{(?:[^{}]|{[^{}]*})*})+}/.source;
+ var parameterPrefix = '(@(?:param|arg|argument|property)\\s+(?:' + type + '\\s+)?)';
+
+ Prism.languages.jsdoc = Prism.languages.extend('javadoclike', {
+ 'parameter': {
+ // @param {string} foo - foo bar
+ pattern: RegExp(parameterPrefix + /[$\w\xA0-\uFFFF.]+(?=\s|$)/.source),
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\./
+ }
+ }
+ });
+
+ Prism.languages.insertBefore('jsdoc', 'keyword', {
+ 'optional-parameter': {
+ // @param {string} [baz.foo="bar"] foo bar
+ pattern: RegExp(parameterPrefix + /\[[$\w\xA0-\uFFFF.]+(?:=[^[\]]+)?\](?=\s|$)/.source),
+ lookbehind: true,
+ inside: {
+ 'parameter': {
+ pattern: /(^\[)[$\w\xA0-\uFFFF\.]+/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\./
+ }
+ },
+ 'code': {
+ pattern: /(=)[\s\S]*(?=\]$)/,
+ lookbehind: true,
+ inside: javascript,
+ alias: 'language-javascript'
+ },
+ 'punctuation': /[=[\]]/
+ }
+ },
+ 'class-name': [
+ {
+ pattern: RegExp('(@[a-z]+\\s+)' + type),
+ lookbehind: true,
+ inside: {
+ 'punctuation': /[.,:?=<>|{}()[\]]/
+ }
+ },
+ {
+ pattern: /(@(?:augments|extends|class|interface|memberof!?|this)\s+)[A-Z]\w*(?:\.[A-Z]\w*)*/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\./
+ }
+ }
+ ],
+ 'example': {
+ pattern: /(@example\s+)[^@]+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,
+ lookbehind: true,
+ inside: {
+ 'code': {
+ pattern: /^(\s*(?:\*\s*)?).+$/m,
+ lookbehind: true,
+ inside: javascript,
+ alias: 'language-javascript'
+ }
+ }
+ }
+ });
+
+ Prism.languages.javadoclike.addSupport('javascript', Prism.languages.jsdoc);
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
Prism.languages.json = {
- 'property': /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,
+ 'property': {
+ pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
+ greedy: true
+ },
'string': {
pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
greedy: true
},
- 'number': /-?\d+\.?\d*([Ee][+-]?\d+)?/,
+ 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
+ 'number': /-?\d+\.?\d*(e[+-]?\d+)?/i,
'punctuation': /[{}[\],]/,
- 'operator': /:/g,
- 'boolean': /\b(?:true|false)\b/i,
- 'null': /\bnull\b/i
+ 'operator': /:/,
+ 'boolean': /\b(?:true|false)\b/,
+ 'null': {
+ pattern: /\bnull\b/,
+ alias: 'keyword'
+ }
};
-Prism.languages.jsonp = Prism.languages.json;
-
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-json"], function () {
+(function (Prism) {
+
+ var string = /("|')(?:\\(?:\r\n?|\n|.)|(?!\1)[^\\\r\n])*\1/
+
+ Prism.languages.json5 = Prism.languages.extend('json', {
+ 'property': [
+ {
+ pattern: RegExp(string.source + '(?=\\s*:)'),
+ greedy: true
+ },
+ {
+ pattern: /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*:)/,
+ alias: 'unquoted'
+ }
+ ],
+ 'string': {
+ pattern: string,
+ greedy: true
+ },
+ 'number': /[+-]?(?:NaN|Infinity|0x[a-fA-F\d]+|(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/
+ });
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-json"], function () {
+Prism.languages.jsonp = Prism.languages.extend('json', {
+ 'punctuation': /[{}[\]();,.]/
+});
+
+Prism.languages.insertBefore('jsonp', 'punctuation', {
+ 'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/
+});
+
+return Prism; })
\ No newline at end of file
-define(["prism/prism","prism/components/prism-markup","prism/components/prism-javascript"], function () {
+define(["prism/prism","prism/components/prism-markup","prism/components/prism-javascript","prism/components/prism-jsdoc","prism/components/prism-js-extras"], function () {
(function(Prism) {
var javascript = Prism.util.clone(Prism.languages.javascript);
Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i;
Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i;
-Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*$/;
+Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
Prism.languages.insertBefore('inside', 'attr-name', {
'spread': {
lookbehind: true
},
'string': /("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2/,
- 'keyword' : /\b(?:abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|let|local|macro|module|print|println|quote|return|try|type|typealias|using|while)\b/,
+ 'keyword' : /\b(?:abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|in|let|local|macro|module|print|println|quote|return|struct|try|type|typealias|using|while)\b/,
'boolean' : /\b(?:true|false)\b/,
'number' : /(?:\b(?=\d)|\B(?=\.))(?:0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:[efp][+-]?\d+)?j?/i,
'operator': /[-+*^%÷&$\\]=?|\/[\/=]?|!=?=?|\|[=>]?|<(?:<=?|[=:])?|>(?:=|>>?=?)?|==?=?|[~≠≤≥]/,
- 'punctuation' : /[{}[\];(),.:]/
+ 'punctuation' : /[{}[\];(),.:]/,
+ 'constant': /\b(?:(?:NaN|Inf)(?:16|32|64)?)\b/
};
+
return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
-(function(Prism) {
- var funcPattern = /\\(?:[^a-z()[\]]|[a-z*]+)/i,
- insideEqu = {
- 'equation-command': {
- pattern: funcPattern,
- alias: 'regex'
- }
- };
+(function (Prism) {
+ var funcPattern = /\\(?:[^a-z()[\]]|[a-z*]+)/i;
+ var insideEqu = {
+ 'equation-command': {
+ pattern: funcPattern,
+ alias: 'regex'
+ }
+ };
Prism.languages.latex = {
'comment': /%.*/m,
// the verbatim environment prints whitespace to the document
- 'cdata': {
+ 'cdata': {
pattern: /(\\begin\{((?:verbatim|lstlisting)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
lookbehind: true
},
/*
- * equations can be between $ $ or \( \) or \[ \]
+ * equations can be between $$ $$ or $ $ or \( \) or \[ \]
* (all are multiline)
*/
'equation': [
{
- pattern: /\$(?:\\[\s\S]|[^\\$])*\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
+ pattern: /\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
inside: insideEqu,
alias: 'string'
},
},
'punctuation': /[[\]{}&]/
};
+
+ Prism.languages.tex = Prism.languages.latex;
+ Prism.languages.context = Prism.languages.latex;
})(Prism);
return Prism; })
\ No newline at end of file
},
'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
- 'punctuation': /[{}();:,]/,
'operator': /[+\-*\/]/
});
-// Invert function and punctuation positions
-Prism.languages.insertBefore('less', 'punctuation', {
- 'function': Prism.languages.less.function
-});
-
Prism.languages.insertBefore('less', 'property', {
'variable': [
// Variable declaration (the colon must be consumed!)
},
comment: /;.*/,
string: {
- pattern: /"(?:[^"\\]*|\\.)*"/,
+ pattern: /"(?:[^"\\]|\\.)*"/,
greedy: true,
inside: {
argument: /[-A-Z]+(?=[.,\s])/,
define(["prism/prism","prism/components/prism-markup"], function () {
-Prism.languages.markdown = Prism.languages.extend('markup', {});
-Prism.languages.insertBefore('markdown', 'prolog', {
- 'blockquote': {
- // > ...
- pattern: /^>(?:[\t ]*>)*/m,
- alias: 'punctuation'
- },
- 'code': [
- {
- // Prefixed by 4 spaces or 1 tab
- pattern: /^(?: {4}|\t).+/m,
- alias: 'keyword'
- },
- {
- // `code`
- // ``code``
- pattern: /``.+?``|`[^`\n]+`/,
- alias: 'keyword'
+(function (Prism) {
+
+ // Allow only one line break
+ var inner = /\\.|[^\\\n\r_]|(?:\r?\n|\r)(?!\r?\n|\r)/.source;
+
+ /**
+ * This function is intended for the creation of the bold or italic pattern.
+ *
+ * This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
+ *
+ * _Note:_ Keep in mind that this adds a capturing group.
+ *
+ * @param {string} pattern
+ * @param {boolean} starAlternative Whether to also add an alternative where all `_`s are replaced with `*`s.
+ * @returns {RegExp}
+ */
+ function createInline(pattern, starAlternative) {
+ pattern = pattern.replace(/<inner>/g, inner);
+ if (starAlternative) {
+ pattern = pattern + '|' + pattern.replace(/_/g, '\\*');
}
- ],
- 'title': [
- {
- // title 1
- // =======
-
- // title 2
- // -------
- pattern: /\w+.*(?:\r?\n|\r)(?:==+|--+)/,
- alias: 'important',
+ return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
+ }
+
+
+ Prism.languages.markdown = Prism.languages.extend('markup', {});
+ Prism.languages.insertBefore('markdown', 'prolog', {
+ 'blockquote': {
+ // > ...
+ pattern: /^>(?:[\t ]*>)*/m,
+ alias: 'punctuation'
+ },
+ 'code': [
+ {
+ // Prefixed by 4 spaces or 1 tab
+ pattern: /^(?: {4}|\t).+/m,
+ alias: 'keyword'
+ },
+ {
+ // `code`
+ // ``code``
+ pattern: /``.+?``|`[^`\n]+`/,
+ alias: 'keyword'
+ },
+ {
+ // ```optional language
+ // code block
+ // ```
+ pattern: /^```[\s\S]*?^```$/m,
+ greedy: true,
+ inside: {
+ 'code-block': {
+ pattern: /^(```.*(?:\r?\n|\r))[\s\S]+?(?=(?:\r?\n|\r)^```$)/m,
+ lookbehind: true
+ },
+ 'code-language': {
+ pattern: /^(```).+/,
+ lookbehind: true
+ },
+ 'punctuation': /```/
+ }
+ }
+ ],
+ 'title': [
+ {
+ // title 1
+ // =======
+
+ // title 2
+ // -------
+ pattern: /\S.*(?:\r?\n|\r)(?:==+|--+)/,
+ alias: 'important',
+ inside: {
+ punctuation: /==+$|--+$/
+ }
+ },
+ {
+ // # title 1
+ // ###### title 6
+ pattern: /(^\s*)#+.+/m,
+ lookbehind: true,
+ alias: 'important',
+ inside: {
+ punctuation: /^#+|#+$/
+ }
+ }
+ ],
+ 'hr': {
+ // ***
+ // ---
+ // * * *
+ // -----------
+ pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
+ lookbehind: true,
+ alias: 'punctuation'
+ },
+ 'list': {
+ // * item
+ // + item
+ // - item
+ // 1. item
+ pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
+ lookbehind: true,
+ alias: 'punctuation'
+ },
+ 'url-reference': {
+ // [id]: http://example.com "Optional title"
+ // [id]: http://example.com 'Optional title'
+ // [id]: http://example.com (Optional title)
+ // [id]: <http://example.com> "Optional title"
+ pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
+ inside: {
+ 'variable': {
+ pattern: /^(!?\[)[^\]]+/,
+ lookbehind: true
+ },
+ 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
+ 'punctuation': /^[\[\]!:]|[<>]/
+ },
+ alias: 'url'
+ },
+ 'bold': {
+ // **strong**
+ // __strong__
+
+ // allow one nested instance of italic text using the same delimiter
+ pattern: createInline(/__(?:<inner>|_(?:<inner>)+_)+__/.source, true),
+ lookbehind: true,
+ greedy: true,
inside: {
- punctuation: /==+$|--+$/
+ 'content': {
+ pattern: /(^..)[\s\S]+(?=..$)/,
+ lookbehind: true,
+ inside: {} // see below
+ },
+ 'punctuation': /\*\*|__/
}
},
- {
- // # title 1
- // ###### title 6
- pattern: /(^\s*)#+.+/m,
+ 'italic': {
+ // *em*
+ // _em_
+
+ // allow one nested instance of bold text using the same delimiter
+ pattern: createInline(/_(?:<inner>|__(?:<inner>)+__)+_/.source, true),
lookbehind: true,
- alias: 'important',
+ greedy: true,
inside: {
- punctuation: /^#+|#+$/
+ 'content': {
+ pattern: /(^.)[\s\S]+(?=.$)/,
+ lookbehind: true,
+ inside: {} // see below
+ },
+ 'punctuation': /[*_]/
+ }
+ },
+ 'strike': {
+ // ~~strike through~~
+ // ~strike~
+
+ // extra _ is because the inner pattern intentionally doesn't include it because of bold and italic
+ pattern: createInline(/(~~?)(?:<inner>|_)+?\2/.source, false),
+ lookbehind: true,
+ greedy: true,
+ inside: {
+ 'content': {
+ pattern: /(^~~?)[\s\S]+(?=\1$)/,
+ lookbehind: true,
+ inside: {} // see below
+ },
+ 'punctuation': /~~?/
}
- }
- ],
- 'hr': {
- // ***
- // ---
- // * * *
- // -----------
- pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
- lookbehind: true,
- alias: 'punctuation'
- },
- 'list': {
- // * item
- // + item
- // - item
- // 1. item
- pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
- lookbehind: true,
- alias: 'punctuation'
- },
- 'url-reference': {
- // [id]: http://example.com "Optional title"
- // [id]: http://example.com 'Optional title'
- // [id]: http://example.com (Optional title)
- // [id]: <http://example.com> "Optional title"
- pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
- inside: {
- 'variable': {
- pattern: /^(!?\[)[^\]]+/,
- lookbehind: true
- },
- 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
- 'punctuation': /^[\[\]!:]|[<>]/
},
- alias: 'url'
- },
- 'bold': {
- // **strong**
- // __strong__
-
- // Allow only one line break
- pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
- lookbehind: true,
- inside: {
- 'punctuation': /^\*\*|^__|\*\*$|__$/
+ 'url': {
+ // [example](http://example.com "Optional title")
+ // [example] [id]
+ pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,
+ inside: {
+ 'variable': {
+ pattern: /(!?\[)[^\]]+(?=\]$)/,
+ lookbehind: true
+ },
+ 'string': {
+ pattern: /"(?:\\.|[^"\\])*"(?=\)$)/
+ }
+ }
}
- },
- 'italic': {
- // *em*
- // _em_
-
- // Allow only one line break
- pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
- lookbehind: true,
- inside: {
- 'punctuation': /^[*_]|[*_]$/
+ });
+
+ ['bold', 'italic', 'strike'].forEach(function (token) {
+ ['url', 'bold', 'italic', 'strike'].forEach(function (inside) {
+ if (token !== inside) {
+ Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
+ }
+ });
+ });
+
+ Prism.hooks.add('after-tokenize', function (env) {
+ if (env.language !== 'markdown' && env.language !== 'md') {
+ return;
}
- },
- 'url': {
- // [example](http://example.com "Optional title")
- // [example] [id]
- pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,
- inside: {
- 'variable': {
- pattern: /(!?\[)[^\]]+(?=\]$)/,
- lookbehind: true
- },
- 'string': {
- pattern: /"(?:\\.|[^"\\])*"(?=\)$)/
+
+ function walkTokens(tokens) {
+ if (!tokens || typeof tokens === 'string') {
+ return;
+ }
+
+ for (var i = 0, l = tokens.length; i < l; i++) {
+ var token = tokens[i];
+
+ if (token.type !== 'code') {
+ walkTokens(token.content);
+ continue;
+ }
+
+ /*
+ * Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
+ * is optional. But the grammar is defined so that there is only one case we have to handle:
+ *
+ * token.content = [
+ * <span class="punctuation">```</span>,
+ * <span class="code-language">xxxx</span>,
+ * '\n', // exactly one new lines (\r or \n or \r\n)
+ * <span class="code-block">...</span>,
+ * '\n', // exactly one new lines again
+ * <span class="punctuation">```</span>
+ * ];
+ */
+
+ var codeLang = token.content[1];
+ var codeBlock = token.content[3];
+
+ if (codeLang && codeBlock &&
+ codeLang.type === 'code-language' && codeBlock.type === 'code-block' &&
+ typeof codeLang.content === 'string') {
+
+ // this might be a language that Prism does not support
+ var alias = 'language-' + codeLang.content.trim().split(/\s+/)[0].toLowerCase();
+
+ // add alias
+ if (!codeBlock.alias) {
+ codeBlock.alias = [alias];
+ } else if (typeof codeBlock.alias === 'string') {
+ codeBlock.alias = [codeBlock.alias, alias];
+ } else {
+ codeBlock.alias.push(alias);
+ }
+ }
}
}
- }
-});
-Prism.languages.markdown['bold'].inside['url'] = Prism.languages.markdown['url'];
-Prism.languages.markdown['italic'].inside['url'] = Prism.languages.markdown['url'];
-Prism.languages.markdown['bold'].inside['italic'] = Prism.languages.markdown['italic'];
-Prism.languages.markdown['italic'].inside['bold'] = Prism.languages.markdown['bold'];
+ walkTokens(env.tokens);
+ });
+
+ Prism.hooks.add('wrap', function (env) {
+ if (env.type !== 'code-block') {
+ return;
+ }
+
+ var codeLang = '';
+ for (var i = 0, l = env.classes.length; i < l; i++) {
+ var cls = env.classes[i];
+ var match = /language-(.+)/.exec(cls);
+ if (match) {
+ codeLang = match[1];
+ break;
+ }
+ }
+
+ var grammar = Prism.languages[codeLang];
+
+ if (!grammar) {
+ return;
+ }
+
+ // reverse Prism.util.encode
+ var code = env.content.replace(/</g, '<').replace(/&/g, '&');
+
+ env.content = Prism.highlight(code, grammar, codeLang);
+ });
+
+ Prism.languages.md = Prism.languages.markdown;
+
+}(Prism));
+
return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-markup"], function () {
-Prism.languages['markup-templating'] = {};
-
-Object.defineProperties(Prism.languages['markup-templating'], {
- buildPlaceholders: {
- // Tokenize all inline templating expressions matching placeholderPattern
- // If the replaceFilter function is provided, it will be called with every match.
- // If it returns false, the match will not be replaced.
- value: function (env, language, placeholderPattern, replaceFilter) {
- if (env.language !== language) {
- return;
- }
+(function (Prism) {
- env.tokenStack = [];
+ /**
+ * Returns the placeholder for the given language id and index.
+ *
+ * @param {string} language
+ * @param {string|number} index
+ * @returns {string}
+ */
+ function getPlaceholder(language, index) {
+ return '___' + language.toUpperCase() + index + '___';
+ }
- env.code = env.code.replace(placeholderPattern, function(match) {
- if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
- return match;
+ Object.defineProperties(Prism.languages['markup-templating'] = {}, {
+ buildPlaceholders: {
+ /**
+ * Tokenize all inline templating expressions matching `placeholderPattern`.
+ *
+ * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
+ * `true` will be replaced.
+ *
+ * @param {object} env The environment of the `before-tokenize` hook.
+ * @param {string} language The language id.
+ * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
+ * @param {(match: string) => boolean} [replaceFilter]
+ */
+ value: function (env, language, placeholderPattern, replaceFilter) {
+ if (env.language !== language) {
+ return;
}
- var i = env.tokenStack.length;
- // Check for existing strings
- while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1)
- ++i;
- // Create a sparse array
- env.tokenStack[i] = match;
+ var tokenStack = env.tokenStack = [];
- return '___' + language.toUpperCase() + i + '___';
- });
+ env.code = env.code.replace(placeholderPattern, function (match) {
+ if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
+ return match;
+ }
+ var i = tokenStack.length;
+ var placeholder;
- // Switch the grammar to markup
- env.grammar = Prism.languages.markup;
- }
- },
- tokenizePlaceholders: {
- // Replace placeholders with proper tokens after tokenizing
- value: function (env, language) {
- if (env.language !== language || !env.tokenStack) {
- return;
- }
+ // Check for existing strings
+ while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1)
+ ++i;
- // Switch the grammar back
- env.grammar = Prism.languages[language];
+ // Create a sparse array
+ tokenStack[i] = match;
- var j = 0;
- var keys = Object.keys(env.tokenStack);
- var walkTokens = function (tokens) {
- if (j >= keys.length) {
+ return placeholder;
+ });
+
+ // Switch the grammar to markup
+ env.grammar = Prism.languages.markup;
+ }
+ },
+ tokenizePlaceholders: {
+ /**
+ * Replace placeholders with proper tokens after tokenizing.
+ *
+ * @param {object} env The environment of the `after-tokenize` hook.
+ * @param {string} language The language id.
+ */
+ value: function (env, language) {
+ if (env.language !== language || !env.tokenStack) {
return;
}
- for (var i = 0; i < tokens.length; i++) {
- var token = tokens[i];
- if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
- var k = keys[j];
- var t = env.tokenStack[k];
- var s = typeof token === 'string' ? token : token.content;
-
- var index = s.indexOf('___' + language.toUpperCase() + k + '___');
- if (index > -1) {
- ++j;
- var before = s.substring(0, index);
- var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t);
- var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length);
- var replacement;
- if (before || after) {
- replacement = [before, middle, after].filter(function (v) { return !!v; });
- walkTokens(replacement);
- } else {
- replacement = middle;
- }
- if (typeof token === 'string') {
- Array.prototype.splice.apply(tokens, [i, 1].concat(replacement));
- } else {
- token.content = replacement;
- }
- if (j >= keys.length) {
- break;
+ // Switch the grammar back
+ env.grammar = Prism.languages[language];
+
+ var j = 0;
+ var keys = Object.keys(env.tokenStack);
+
+ function walkTokens(tokens) {
+ for (var i = 0; i < tokens.length; i++) {
+ // all placeholders are replaced already
+ if (j >= keys.length) {
+ break;
+ }
+
+ var token = tokens[i];
+ if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
+ var k = keys[j];
+ var t = env.tokenStack[k];
+ var s = typeof token === 'string' ? token : token.content;
+ var placeholder = getPlaceholder(language, k);
+
+ var index = s.indexOf(placeholder);
+ if (index > -1) {
+ ++j;
+
+ var before = s.substring(0, index);
+ var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
+ var after = s.substring(index + placeholder.length);
+
+ var replacement = [];
+ if (before) {
+ replacement.push.apply(replacement, walkTokens([before]));
+ }
+ replacement.push(middle);
+ if (after) {
+ replacement.push.apply(replacement, walkTokens([after]));
+ }
+
+ if (typeof token === 'string') {
+ tokens.splice.apply(tokens, [i, 1].concat(replacement));
+ } else {
+ token.content = replacement;
+ }
}
+ } else if (token.content /* && typeof token.content !== 'string' */) {
+ walkTokens(token.content);
}
- } else if (token.content && typeof token.content !== 'string') {
- walkTokens(token.content);
}
+
+ return tokens;
}
- };
- walkTokens(env.tokens);
+ walkTokens(env.tokens);
+ }
}
- }
-});
+ });
+
+}(Prism));
+
return Prism; })
\ No newline at end of file
'doctype': /<!DOCTYPE[\s\S]+?>/i,
'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
'tag': {
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,
greedy: true,
inside: {
'tag': {
}
},
'attr-value': {
- pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,
inside: {
'punctuation': [
/^=/,
{
- pattern: /(^|[^\\])["']/,
+ pattern: /^(\s*)["']|["']$/,
lookbehind: true
}
]
}
});
-Prism.languages.xml = Prism.languages.markup;
+Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
+ /**
+ * Adds an inlined language to markup.
+ *
+ * An example of an inlined language is CSS with `<style>` tags.
+ *
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
+ * case insensitive.
+ * @param {string} lang The language key.
+ * @example
+ * addInlined('style', 'css');
+ */
+ value: function addInlined(tagName, lang) {
+ var includedCdataInside = {};
+ includedCdataInside['language-' + lang] = {
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
+ lookbehind: true,
+ inside: Prism.languages[lang]
+ };
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
+
+ var inside = {
+ 'included-cdata': {
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
+ inside: includedCdataInside
+ }
+ };
+ inside['language-' + lang] = {
+ pattern: /[\s\S]+/,
+ inside: Prism.languages[lang]
+ };
+
+ var def = {};
+ def[tagName] = {
+ pattern: RegExp(/(<__[\s\S]*?>)(?:<!\[CDATA\[[\s\S]*?\]\]>\s*|[\s\S])*?(?=<\/__>)/.source.replace(/__/g, tagName), 'i'),
+ lookbehind: true,
+ greedy: true,
+ inside: inside
+ };
+
+ Prism.languages.insertBefore('markup', 'cdata', def);
+ }
+});
+
+Prism.languages.xml = Prism.languages.extend('markup', {});
Prism.languages.html = Prism.languages.markup;
Prism.languages.mathml = Prism.languages.markup;
Prism.languages.svg = Prism.languages.markup;
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages.n1ql = {
+ 'comment': /\/\*[\s\S]*?(?:$|\*\/)/,
+ 'parameter': /\$[\w.]+/,
+ 'string': {
+ pattern: /(["'])(?:\\[\s\S]|(?!\1)[^\\]|\1\1)*\1/,
+ greedy: true,
+ },
+ 'identifier': {
+ pattern: /`(?:\\[\s\S]|[^\\`]|``)*`/,
+ greedy: true,
+ },
+ 'function': /\b(?:ABS|ACOS|ARRAY_AGG|ARRAY_APPEND|ARRAY_AVG|ARRAY_CONCAT|ARRAY_CONTAINS|ARRAY_COUNT|ARRAY_DISTINCT|ARRAY_FLATTEN|ARRAY_IFNULL|ARRAY_INSERT|ARRAY_INTERSECT|ARRAY_LENGTH|ARRAY_MAX|ARRAY_MIN|ARRAY_POSITION|ARRAY_PREPEND|ARRAY_PUT|ARRAY_RANGE|ARRAY_REMOVE|ARRAY_REPEAT|ARRAY_REPLACE|ARRAY_REVERSE|ARRAY_SORT|ARRAY_STAR|ARRAY_SUM|ARRAY_SYMDIFF|ARRAY_SYMDIFFN|ARRAY_UNION|ASIN|ATAN|ATAN2|AVG|BASE64|BASE64_DECODE|BASE64_ENCODE|BITAND|BITCLEAR|BITNOT|BITOR|BITSET|BITSHIFT|BITTEST|BITXOR|CEIL|CLOCK_LOCAL|CLOCK_MILLIS|CLOCK_STR|CLOCK_TZ|CLOCK_UTC|CONTAINS|CONTAINS_TOKEN|CONTAINS_TOKEN_LIKE|CONTAINS_TOKEN_REGEXP|COS|COUNT|CURL|DATE_ADD_MILLIS|DATE_ADD_STR|DATE_DIFF_MILLIS|DATE_DIFF_STR|DATE_FORMAT_STR|DATE_PART_MILLIS|DATE_PART_STR|DATE_RANGE_MILLIS|DATE_RANGE_STR|DATE_TRUNC_MILLIS|DATE_TRUNC_STR|DECODE_JSON|DEGREES|DURATION_TO_STR|E|ENCODED_SIZE|ENCODE_JSON|EXP|FLOOR|GREATEST|HAS_TOKEN|IFINF|IFMISSING|IFMISSINGORNULL|IFNAN|IFNANORINF|IFNULL|INITCAP|ISARRAY|ISATOM|ISBOOLEAN|ISNUMBER|ISOBJECT|ISSTRING|IsBitSET|LEAST|LENGTH|LN|LOG|LOWER|LTRIM|MAX|META|MILLIS|MILLIS_TO_LOCAL|MILLIS_TO_STR|MILLIS_TO_TZ|MILLIS_TO_UTC|MILLIS_TO_ZONE_NAME|MIN|MISSINGIF|NANIF|NEGINFIF|NOW_LOCAL|NOW_MILLIS|NOW_STR|NOW_TZ|NOW_UTC|NULLIF|OBJECT_ADD|OBJECT_CONCAT|OBJECT_INNER_PAIRS|OBJECT_INNER_VALUES|OBJECT_LENGTH|OBJECT_NAMES|OBJECT_PAIRS|OBJECT_PUT|OBJECT_REMOVE|OBJECT_RENAME|OBJECT_REPLACE|OBJECT_UNWRAP|OBJECT_VALUES|PAIRS|PI|POLY_LENGTH|POSINFIF|POSITION|POWER|RADIANS|RANDOM|REGEXP_CONTAINS|REGEXP_LIKE|REGEXP_POSITION|REGEXP_REPLACE|REPEAT|REPLACE|REVERSE|ROUND|RTRIM|SIGN|SIN|SPLIT|SQRT|STR_TO_DURATION|STR_TO_MILLIS|STR_TO_TZ|STR_TO_UTC|STR_TO_ZONE_NAME|SUBSTR|SUFFIXES|SUM|TAN|TITLE|TOARRAY|TOATOM|TOBOOLEAN|TOKENS|TOKENS|TONUMBER|TOOBJECT|TOSTRING|TRIM|TRUNC|TYPE|UPPER|WEEKDAY_MILLIS|WEEKDAY_STR)(?=\s*\()/i,
+ 'keyword': /\b(?:ALL|ALTER|ANALYZE|AS|ASC|BEGIN|BINARY|BOOLEAN|BREAK|BUCKET|BUILD|BY|CALL|CAST|CLUSTER|COLLATE|COLLECTION|COMMIT|CONNECT|CONTINUE|CORRELATE|COVER|CREATE|DATABASE|DATASET|DATASTORE|DECLARE|DECREMENT|DELETE|DERIVED|DESC|DESCRIBE|DISTINCT|DO|DROP|EACH|ELEMENT|EXCEPT|EXCLUDE|EXECUTE|EXPLAIN|FETCH|FLATTEN|FOR|FORCE|FROM|FUNCTION|GRANT|GROUP|GSI|HAVING|IF|IGNORE|ILIKE|INCLUDE|INCREMENT|INDEX|INFER|INLINE|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KEYS|KEYSPACE|KNOWN|LAST|LEFT|LET|LETTING|LIMIT|LSM|MAP|MAPPING|MATCHED|MATERIALIZED|MERGE|MINUS|MISSING|NAMESPACE|NEST|NULL|NUMBER|OBJECT|OFFSET|ON|OPTION|ORDER|OUTER|OVER|PARSE|PARTITION|PASSWORD|PATH|POOL|PREPARE|PRIMARY|PRIVATE|PRIVILEGE|PROCEDURE|PUBLIC|RAW|REALM|REDUCE|RENAME|RETURN|RETURNING|REVOKE|RIGHT|ROLE|ROLLBACK|SATISFIES|SCHEMA|SELECT|SELF|SEMI|SET|SHOW|SOME|START|STATISTICS|STRING|SYSTEM|TO|TRANSACTION|TRIGGER|TRUNCATE|UNDER|UNION|UNIQUE|UNKNOWN|UNNEST|UNSET|UPDATE|UPSERT|USE|USER|USING|VALIDATE|VALUE|VALUES|VIA|VIEW|WHERE|WHILE|WITH|WORK|XOR)\b/i,
+ 'boolean': /\b(?:TRUE|FALSE)\b/i,
+ 'number': /(?:\b\d+\.|\B\.)\d+e[+\-]?\d+\b|\b\d+\.?\d*|\B\.\d+\b/i,
+ 'operator': /[-+*\/=%]|!=|==?|\|\||<[>=]?|>=?|\b(?:AND|ANY|ARRAY|BETWEEN|CASE|ELSE|END|EVERY|EXISTS|FIRST|IN|LIKE|NOT|OR|THEN|VALUED|WHEN|WITHIN)\b/i,
+ 'punctuation': /[;[\](),.{}:]/
+};
+return Prism; })
\ No newline at end of file
-define(["prism/prism","prism/components/prism-javascript"], function () {
+define(["prism/prism","prism/components/prism-javascript","prism/components/prism-jsdoc"], function () {
Prism.languages.n4js = Prism.languages.extend('javascript', {
// Keywords from N4JS language spec: https://numberfour.github.io/n4js/spec/N4JSSpec.html
'keyword': /\b(?:any|Array|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/
--- /dev/null
+define(["prism/prism"], function () {
+Prism.languages['nand2tetris-hdl'] = {
+ 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
+ 'keyword': /\b(?:CHIP|IN|OUT|PARTS|BUILTIN|CLOCKED)\b/,
+ 'boolean': /\b(?:true|false)\b/,
+ 'function': /[A-Za-z][A-Za-z0-9]*(?=\()/,
+ 'number': /\b\d+\b/,
+ 'operator': /=|\.\./,
+ 'punctuation': /[{}[\];(),:]/
+};
+
+return Prism; })
\ No newline at end of file
pattern: /(^|[^"{\\])#.*/,
lookbehind: true
},
- 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types)\b/i
+ 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types|ssl_session_tickets|ssl_stapling|ssl_stapling_verify|ssl_ecdh_curve|ssl_trusted_certificate|more_set_headers|ssl_early_data)\b/i
});
Prism.languages.insertBefore('nginx', 'keyword', {
'variable': /\$[a-z_]+/i
});
+
return Prism; })
\ No newline at end of file
'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
});
+delete Prism.languages.objectivec['class-name'];
+
return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-markup"], function () {
-Prism.languages.parser = Prism.languages.extend('markup', {
- 'keyword': {
- pattern: /(^|[^^])(?:\^(?:case|eval|for|if|switch|throw)\b|@(?:BASE|CLASS|GET(?:_DEFAULT)?|OPTIONS|SET_DEFAULT|USE)\b)/,
- lookbehind: true
- },
- 'variable': {
- pattern: /(^|[^^])\B\$(?:\w+|(?=[.{]))(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
- lookbehind: true,
- inside: {
- 'punctuation': /\.|:+/
+(function (Prism) {
+
+ var parser = Prism.languages.parser = Prism.languages.extend('markup', {
+ 'keyword': {
+ pattern: /(^|[^^])(?:\^(?:case|eval|for|if|switch|throw)\b|@(?:BASE|CLASS|GET(?:_DEFAULT)?|OPTIONS|SET_DEFAULT|USE)\b)/,
+ lookbehind: true
+ },
+ 'variable': {
+ pattern: /(^|[^^])\B\$(?:\w+|(?=[.{]))(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
+ lookbehind: true,
+ inside: {
+ 'punctuation': /\.|:+/
+ }
+ },
+ 'function': {
+ pattern: /(^|[^^])\B[@^]\w+(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
+ lookbehind: true,
+ inside: {
+ 'keyword': {
+ pattern: /(^@)(?:GET_|SET_)/,
+ lookbehind: true
+ },
+ 'punctuation': /\.|:+/
+ }
+ },
+ 'escape': {
+ pattern: /\^(?:[$^;@()\[\]{}"':]|#[a-f\d]*)/i,
+ alias: 'builtin'
+ },
+ 'punctuation': /[\[\](){};]/
+ });
+
+ parser = Prism.languages.insertBefore('parser', 'keyword', {
+ 'parser-comment': {
+ pattern: /(\s)#.*/,
+ lookbehind: true,
+ alias: 'comment'
+ },
+ 'expression': {
+ // Allow for 3 levels of depth
+ pattern: /(^|[^^])\((?:[^()]|\((?:[^()]|\((?:[^()])*\))*\))*\)/,
+ greedy: true,
+ lookbehind: true,
+ inside: {
+ 'string': {
+ pattern: /(^|[^^])(["'])(?:(?!\2)[^^]|\^[\s\S])*\2/,
+ lookbehind: true
+ },
+ 'keyword': parser.keyword,
+ 'variable': parser.variable,
+ 'function': parser.function,
+ 'boolean': /\b(?:true|false)\b/,
+ 'number': /\b(?:0x[a-f\d]+|\d+\.?\d*(?:e[+-]?\d+)?)\b/i,
+ 'escape': parser.escape,
+ 'operator': /[~+*\/\\%]|!(?:\|\|?|=)?|&&?|\|\|?|==|<[<=]?|>[>=]?|-[fd]?|\b(?:def|eq|ge|gt|in|is|le|lt|ne)\b/,
+ 'punctuation': parser.punctuation
+ }
}
- },
- 'function': {
- pattern: /(^|[^^])\B[@^]\w+(?:(?:\.|::?)\w+)*(?:\.|::?)?/,
- lookbehind: true,
- inside: {
- 'keyword': {
- pattern: /(^@)(?:GET_|SET_)/,
- lookbehind: true
- },
- 'punctuation': /\.|:+/
+ });
+
+ parser = Prism.languages.insertBefore('inside', 'punctuation', {
+ 'expression': parser.expression,
+ 'keyword': parser.keyword,
+ 'variable': parser.variable,
+ 'function': parser.function,
+ 'escape': parser.escape,
+ 'parser-punctuation': {
+ pattern: parser.punctuation,
+ alias: 'punctuation'
}
- },
- 'escape': {
- pattern: /\^(?:[$^;@()\[\]{}"':]|#[a-f\d]*)/i,
- alias: 'builtin'
- },
- 'punctuation': /[\[\](){};]/
-});
-Prism.languages.insertBefore('parser', 'keyword', {
- 'parser-comment': {
- pattern: /(\s)#.*/,
- lookbehind: true,
- alias: 'comment'
- },
- 'expression': {
- // Allow for 3 levels of depth
- pattern: /(^|[^^])\((?:[^()]|\((?:[^()]|\((?:[^()])*\))*\))*\)/,
- greedy: true,
- lookbehind: true,
- inside: {
- 'string': {
- pattern: /(^|[^^])(["'])(?:(?!\2)[^^]|\^[\s\S])*\2/,
- lookbehind: true
- },
- 'keyword': Prism.languages.parser.keyword,
- 'variable': Prism.languages.parser.variable,
- 'function': Prism.languages.parser.function,
- 'boolean': /\b(?:true|false)\b/,
- 'number': /\b(?:0x[a-f\d]+|\d+\.?\d*(?:e[+-]?\d+)?)\b/i,
- 'escape': Prism.languages.parser.escape,
- 'operator': /[~+*\/\\%]|!(?:\|\|?|=)?|&&?|\|\|?|==|<[<=]?|>[>=]?|-[fd]?|\b(?:def|eq|ge|gt|in|is|le|lt|ne)\b/,
- 'punctuation': Prism.languages.parser.punctuation
- }
- }
-});
-Prism.languages.insertBefore('inside', 'punctuation', {
- 'expression': Prism.languages.parser.expression,
- 'keyword': Prism.languages.parser.keyword,
- 'variable': Prism.languages.parser.variable,
- 'function': Prism.languages.parser.function,
- 'escape': Prism.languages.parser.escape,
- 'parser-punctuation': {
- pattern: Prism.languages.parser.punctuation,
- alias: 'punctuation'
- }
-}, Prism.languages.parser['tag'].inside['attr-value']);
+ }, parser['tag'].inside['attr-value']);
+
+}(Prism));
+
return Prism; })
\ No newline at end of file
keyword: /sub/
}
},
- 'keyword': /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
+ 'keyword': /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:\d(?:_?\d)*)?\.?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,
'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/,
'punctuation': /[{}[\];(),:]/
*/
(function (Prism) {
Prism.languages.php = Prism.languages.extend('clike', {
- 'keyword': /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
- 'constant': /\b[A-Z0-9_]{2,}\b/,
+ 'keyword': /\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|parent|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,
+ 'boolean': {
+ pattern: /\b(?:false|true)\b/i,
+ alias: 'constant'
+ },
+ 'constant': [
+ /\b[A-Z_][A-Z0-9_]*\b/,
+ /\b(?:null)\b/i,
+ ],
'comment': {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
lookbehind: true
}
});
- Prism.languages.insertBefore('php', 'keyword', {
+ Prism.languages.insertBefore('php', 'comment', {
'delimiter': {
- pattern: /\?>|<\?(?:php|=)?/i,
+ pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
alias: 'important'
- },
+ }
+ });
+
+ Prism.languages.insertBefore('php', 'keyword', {
'variable': /\$+(?:\w+\b|(?={))/i,
'package': {
pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
delete Prism.languages.php['string'];
Prism.hooks.add('before-tokenize', function(env) {
- if (!/(?:<\?php|<\?)/ig.test(env.code)) {
+ if (!/<\?/.test(env.code)) {
return;
}
- var phpPattern = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig;
+ var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#)(?:[^?\n\r]|\?(?!>))*|\/\*[\s\S]*?(?:\*\/|$))*?(?:\?>|$)/ig;
Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
});
});
}(Prism));
+
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-php","prism/components/prism-javadoclike"], function () {
+(function (Prism) {
+
+ var typeExpression = /(?:[a-zA-Z]\w*|[|\\[\]])+/.source;
+
+ Prism.languages.phpdoc = Prism.languages.extend('javadoclike', {
+ 'parameter': {
+ pattern: RegExp('(@(?:global|param|property(?:-read|-write)?|var)\\s+(?:' + typeExpression + '\\s+)?)\\$\\w+'),
+ lookbehind: true
+ }
+ });
+
+ Prism.languages.insertBefore('phpdoc', 'keyword', {
+ 'class-name': [
+ {
+ pattern: RegExp('(@(?:global|package|param|property(?:-read|-write)?|return|subpackage|throws|var)\\s+)' + typeExpression),
+ lookbehind: true,
+ inside: {
+ 'keyword': /\b(?:callback|resource|boolean|integer|double|object|string|array|false|float|mixed|bool|null|self|true|void|int)\b/,
+ 'punctuation': /[|\\[\]()]/
+ }
+ }
+ ],
+ });
+
+ Prism.languages.javadoclike.addSupport('php', Prism.languages.phpdoc);
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-sql"], function () {
-Prism.languages.plsql = Prism.languages.extend('sql', {
- 'comment': [
- /\/\*[\s\S]*?\*\//,
- /--.*/
- ]
-});
+(function (Prism) {
-if (Prism.util.type(Prism.languages.plsql['keyword']) !== 'Array') {
- Prism.languages.plsql['keyword'] = [Prism.languages.plsql['keyword']];
-}
-Prism.languages.plsql['keyword'].unshift(
- /\b(?:ACCESS|AGENT|AGGREGATE|ARRAY|ARROW|AT|ATTRIBUTE|AUDIT|AUTHID|BFILE_BASE|BLOB_BASE|BLOCK|BODY|BOTH|BOUND|BYTE|CALLING|CHAR_BASE|CHARSET(?:FORM|ID)|CLOB_BASE|COLAUTH|COLLECT|CLUSTERS?|COMPILED|COMPRESS|CONSTANT|CONSTRUCTOR|CONTEXT|CRASH|CUSTOMDATUM|DANGLING|DATE_BASE|DEFINE|DETERMINISTIC|DURATION|ELEMENT|EMPTY|EXCEPTIONS?|EXCLUSIVE|EXTERNAL|FINAL|FORALL|FORM|FOUND|GENERAL|HEAP|HIDDEN|IDENTIFIED|IMMEDIATE|INCLUDING|INCREMENT|INDICATOR|INDEXES|INDICES|INFINITE|INITIAL|ISOPEN|INSTANTIABLE|INTERFACE|INVALIDATE|JAVA|LARGE|LEADING|LENGTH|LIBRARY|LIKE[24C]|LIMITED|LONG|LOOP|MAP|MAXEXTENTS|MAXLEN|MEMBER|MINUS|MLSLABEL|MULTISET|NAME|NAN|NATIVE|NEW|NOAUDIT|NOCOMPRESS|NOCOPY|NOTFOUND|NOWAIT|NUMBER(?:_BASE)?|OBJECT|OCI(?:COLL|DATE|DATETIME|DURATION|INTERVAL|LOBLOCATOR|NUMBER|RAW|REF|REFCURSOR|ROWID|STRING|TYPE)|OFFLINE|ONLINE|ONLY|OPAQUE|OPERATOR|ORACLE|ORADATA|ORGANIZATION|ORL(?:ANY|VARY)|OTHERS|OVERLAPS|OVERRIDING|PACKAGE|PARALLEL_ENABLE|PARAMETERS?|PASCAL|PCTFREE|PIPE(?:LINED)?|PRAGMA|PRIOR|PRIVATE|RAISE|RANGE|RAW|RECORD|REF|REFERENCE|REM|REMAINDER|RESULT|RESOURCE|RETURNING|REVERSE|ROW(?:ID|NUM|TYPE)|SAMPLE|SB[124]|SEGMENT|SELF|SEPARATE|SEQUENCE|SHORT|SIZE(?:_T)?|SPARSE|SQL(?:CODE|DATA|NAME|STATE)|STANDARD|STATIC|STDDEV|STORED|STRING|STRUCT|STYLE|SUBMULTISET|SUBPARTITION|SUBSTITUTABLE|SUBTYPE|SUCCESSFUL|SYNONYM|SYSDATE|TABAUTH|TDO|THE|TIMEZONE_(?:ABBR|HOUR|MINUTE|REGION)|TRAILING|TRANSAC(?:TIONAL)?|TRUSTED|UB[124]|UID|UNDER|UNTRUSTED|VALIDATE|VALIST|VARCHAR2|VARIABLE|VARIANCE|VARRAY|VIEWS|VOID|WHENEVER|WRAPPED|ZONE)\b/i
-);
+ var plsql = Prism.languages.plsql = Prism.languages.extend('sql', {
+ 'comment': [
+ /\/\*[\s\S]*?\*\//,
+ /--.*/
+ ]
+ });
+
+ var keyword = plsql['keyword'];
+ if (!Array.isArray(keyword)) {
+ keyword = plsql['keyword'] = [keyword];
+ }
+ keyword.unshift(
+ /\b(?:ACCESS|AGENT|AGGREGATE|ARRAY|ARROW|AT|ATTRIBUTE|AUDIT|AUTHID|BFILE_BASE|BLOB_BASE|BLOCK|BODY|BOTH|BOUND|BYTE|CALLING|CHAR_BASE|CHARSET(?:FORM|ID)|CLOB_BASE|COLAUTH|COLLECT|CLUSTERS?|COMPILED|COMPRESS|CONSTANT|CONSTRUCTOR|CONTEXT|CRASH|CUSTOMDATUM|DANGLING|DATE_BASE|DEFINE|DETERMINISTIC|DURATION|ELEMENT|EMPTY|EXCEPTIONS?|EXCLUSIVE|EXTERNAL|FINAL|FORALL|FORM|FOUND|GENERAL|HEAP|HIDDEN|IDENTIFIED|IMMEDIATE|INCLUDING|INCREMENT|INDICATOR|INDEXES|INDICES|INFINITE|INITIAL|ISOPEN|INSTANTIABLE|INTERFACE|INVALIDATE|JAVA|LARGE|LEADING|LENGTH|LIBRARY|LIKE[24C]|LIMITED|LONG|LOOP|MAP|MAXEXTENTS|MAXLEN|MEMBER|MINUS|MLSLABEL|MULTISET|NAME|NAN|NATIVE|NEW|NOAUDIT|NOCOMPRESS|NOCOPY|NOTFOUND|NOWAIT|NUMBER(?:_BASE)?|OBJECT|OCI(?:COLL|DATE|DATETIME|DURATION|INTERVAL|LOBLOCATOR|NUMBER|RAW|REF|REFCURSOR|ROWID|STRING|TYPE)|OFFLINE|ONLINE|ONLY|OPAQUE|OPERATOR|ORACLE|ORADATA|ORGANIZATION|ORL(?:ANY|VARY)|OTHERS|OVERLAPS|OVERRIDING|PACKAGE|PARALLEL_ENABLE|PARAMETERS?|PASCAL|PCTFREE|PIPE(?:LINED)?|PRAGMA|PRIOR|PRIVATE|RAISE|RANGE|RAW|RECORD|REF|REFERENCE|REM|REMAINDER|RESULT|RESOURCE|RETURNING|REVERSE|ROW(?:ID|NUM|TYPE)|SAMPLE|SB[124]|SEGMENT|SELF|SEPARATE|SEQUENCE|SHORT|SIZE(?:_T)?|SPARSE|SQL(?:CODE|DATA|NAME|STATE)|STANDARD|STATIC|STDDEV|STORED|STRING|STRUCT|STYLE|SUBMULTISET|SUBPARTITION|SUBSTITUTABLE|SUBTYPE|SUCCESSFUL|SYNONYM|SYSDATE|TABAUTH|TDO|THE|TIMEZONE_(?:ABBR|HOUR|MINUTE|REGION)|TRAILING|TRANSAC(?:TIONAL)?|TRUSTED|UB[124]|UID|UNDER|UNTRUSTED|VALIDATE|VALIST|VARCHAR2|VARIABLE|VARIANCE|VARRAY|VIEWS|VOID|WHENEVER|WRAPPED|ZONE)\b/i
+ );
+
+ var operator = plsql['operator'];
+ if (!Array.isArray(operator)) {
+ operator = plsql['operator'] = [operator];
+ }
+ operator.unshift(
+ /:=/
+ );
+
+}(Prism));
-if (Prism.util.type(Prism.languages.plsql['operator']) !== 'Array') {
- Prism.languages.plsql['operator'] = [Prism.languages.plsql['operator']];
-}
-Prism.languages.plsql['operator'].unshift(
- /:=/
-);
return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
-Prism.languages.powershell = {
- 'comment': [
- {
- pattern: /(^|[^`])<#[\s\S]*?#>/,
- lookbehind: true
- },
- {
- pattern: /(^|[^`])#.*/,
- lookbehind: true
- }
- ],
- 'string': [
- {
- pattern: /"(?:`[\s\S]|[^`"])*"/,
- greedy: true,
- inside: {
- 'function': {
- // Allow for one level of nesting
- pattern: /(^|[^`])\$\((?:\$\(.*?\)|(?!\$\()[^\r\n)])*\)/,
- lookbehind: true,
- // Populated at end of file
- inside: {}
+(function (Prism) {
+
+ var powershell = Prism.languages.powershell = {
+ 'comment': [
+ {
+ pattern: /(^|[^`])<#[\s\S]*?#>/,
+ lookbehind: true
+ },
+ {
+ pattern: /(^|[^`])#.*/,
+ lookbehind: true
+ }
+ ],
+ 'string': [
+ {
+ pattern: /"(?:`[\s\S]|[^`"])*"/,
+ greedy: true,
+ inside: {
+ 'function': {
+ // Allow for one level of nesting
+ pattern: /(^|[^`])\$\((?:\$\(.*?\)|(?!\$\()[^\r\n)])*\)/,
+ lookbehind: true,
+ // Populated at end of file
+ inside: {}
+ }
}
+ },
+ {
+ pattern: /'(?:[^']|'')*'/,
+ greedy: true
}
+ ],
+ // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
+ // Supports two levels of nested brackets (e.g. `[OutputType([System.Collections.Generic.List[int]])]`)
+ 'namespace': /\[[a-z](?:\[(?:\[[^\]]*]|[^\[\]])*]|[^\[\]])*]/i,
+ 'boolean': /\$(?:true|false)\b/i,
+ 'variable': /\$\w+\b/i,
+ // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
+ // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
+ // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
+ 'function': [
+ /\b(?:Add-(?:Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-Computer|Clear-(?:Content|EventLog|History|Item|ItemProperty|Variable)|Compare-Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(?:Csv|Json|StringData)|Convert-Path|ConvertTo-(?:Csv|Html|Json|Xml)|Copy-(?:Item|ItemProperty)|Debug-Process|Disable-(?:ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-PSSession|Enable-(?:ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-PSSession|Exit-PSSession|Export-(?:Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-Object|Format-(?:Custom|List|Table|Wide)|Get-(?:Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(?:Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(?:Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(?:Command|Object)|Move-(?:Item|ItemProperty)|New-(?:Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(?:Default|File|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Receive-(?:Job|PSSession)|Register-(?:EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(?:Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(?:Computer|Item|ItemProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(?:Computer|Service)|Restore-Computer|Resume-(?:Job|Service)|Save-Help|Select-(?:Object|String|Xml)|Send-MailMessage|Set-(?:Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(?:Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(?:Job|Process|Service|Sleep|Transaction)|Stop-(?:Computer|Job|Process|Service)|Suspend-(?:Job|Service)|Tee-Object|Test-(?:ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregister-(?:Event|PSSessionConfiguration)|Update-(?:FormatData|Help|List|TypeData)|Use-Transaction|Wait-(?:Event|Job|Process)|Where-Object|Write-(?:Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/i,
+ /\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i
+ ],
+ // per http://technet.microsoft.com/en-us/library/hh847744.aspx
+ 'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
+ 'operator': {
+ pattern: /(\W?)(?:!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(?:and|x?or)|(?:Not)?(?:Like|Match|Contains|In)|Replace|Join|is(?:Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
+ lookbehind: true
},
- {
- pattern: /'(?:[^']|'')*'/,
- greedy: true
- }
- ],
- // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
- // Supports two levels of nested brackets (e.g. `[OutputType([System.Collections.Generic.List[int]])]`)
- 'namespace': /\[[a-z](?:\[(?:\[[^\]]*]|[^\[\]])*]|[^\[\]])*]/i,
- 'boolean': /\$(?:true|false)\b/i,
- 'variable': /\$\w+\b/i,
- // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
- // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
- // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
- 'function': [
- /\b(?:Add-(?:Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-Computer|Clear-(?:Content|EventLog|History|Item|ItemProperty|Variable)|Compare-Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(?:Csv|Json|StringData)|Convert-Path|ConvertTo-(?:Csv|Html|Json|Xml)|Copy-(?:Item|ItemProperty)|Debug-Process|Disable-(?:ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-PSSession|Enable-(?:ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-PSSession|Exit-PSSession|Export-(?:Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-Object|Format-(?:Custom|List|Table|Wide)|Get-(?:Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(?:Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(?:Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(?:Command|Object)|Move-(?:Item|ItemProperty)|New-(?:Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(?:Default|File|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Receive-(?:Job|PSSession)|Register-(?:EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(?:Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(?:Computer|Item|ItemProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(?:Computer|Service)|Restore-Computer|Resume-(?:Job|Service)|Save-Help|Select-(?:Object|String|Xml)|Send-MailMessage|Set-(?:Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(?:Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(?:Job|Process|Service|Sleep|Transaction)|Stop-(?:Computer|Job|Process|Service)|Suspend-(?:Job|Service)|Tee-Object|Test-(?:ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregister-(?:Event|PSSessionConfiguration)|Update-(?:FormatData|Help|List|TypeData)|Use-Transaction|Wait-(?:Event|Job|Process)|Where-Object|Write-(?:Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/i,
- /\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i
- ],
- // per http://technet.microsoft.com/en-us/library/hh847744.aspx
- 'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
- 'operator': {
- pattern: /(\W?)(?:!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(?:and|x?or)|(?:Not)?(?:Like|Match|Contains|In)|Replace|Join|is(?:Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
- lookbehind: true
- },
- 'punctuation': /[|{}[\];(),.]/
-};
+ 'punctuation': /[|{}[\];(),.]/
+ };
+
+ // Variable interpolation inside strings, and nested expressions
+ var stringInside = powershell.string[0].inside;
+ stringInside.boolean = powershell.boolean;
+ stringInside.variable = powershell.variable;
+ stringInside.function.inside = powershell;
-// Variable interpolation inside strings, and nested expressions
-Prism.languages.powershell.string[0].inside.boolean = Prism.languages.powershell.boolean;
-Prism.languages.powershell.string[0].inside.variable = Prism.languages.powershell.variable;
-Prism.languages.powershell.string[0].inside.function.inside = Prism.languages.powershell;
+}(Prism));
return Prism; })
\ No newline at end of file
-define(["prism/prism","prism/components/prism-javascript","prism/components/prism-coffeescript","prism/components/prism-ejs","prism/components/prism-handlebars","prism/components/prism-hogan","prism/components/prism-less","prism/components/prism-livescript","prism/components/prism-markdown","prism/components/prism-mustache","prism/components/prism-plates","prism/components/prism-scss","prism/components/prism-stylus","prism/components/prism-swig"], function () {
+define(["prism/prism","prism/components/prism-markup","prism/components/prism-javascript","prism/components/prism-coffeescript","prism/components/prism-ejs","prism/components/prism-handlebars","prism/components/prism-less","prism/components/prism-livescript","prism/components/prism-markdown","prism/components/prism-scss","prism/components/prism-stylus","prism/components/prism-twig"], function () {
(function(Prism) {
// TODO:
// - Add CSS highlighting inside <style> tags
'punctuation': /[.\-!=|]+/
};
- var filter_pattern = '(^([\\t ]*)):{{filter_name}}(?:(?:\\r?\\n|\\r(?!\\n))(?:\\2[\\t ]+.+|\\s*?(?=\\r?\\n|\\r)))+';
+ var filter_pattern = /(^([\t ]*)):{{filter_name}}(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/.source;
// Non exhaustive list of available filters and associated languages
var filters = [
{filter:'coffee',language:'coffeescript'},
'ejs',
'handlebars',
- 'hogan',
'less',
'livescript',
'markdown',
- 'mustache',
- 'plates',
{filter:'sass',language:'scss'},
- 'stylus',
- 'swig'
-
+ 'stylus'
];
var all_filters = {};
for (var i = 0, l = filters.length; i < l; i++) {
-define(["prism/prism","prism/components/prism-c","prism/components/prism-cpp","prism/components/prism-fortran","prism/components/prism-ats","prism/components/prism-dsp"], function () {
+define(["prism/prism","prism/components/prism-c","prism/components/prism-cpp","prism/components/prism-fortran"], function () {
(function (Prism) {
Prism.languages.pure = {
'comment': [
var inlineLanguages = [
'c',
{ lang: 'c++', alias: 'cpp' },
- 'fortran',
- 'ats',
- 'dsp'
+ 'fortran'
];
- var inlineLanguageRe = '%< *-\\*- *{lang}\\d* *-\\*-[\\s\\S]+?%>';
+ var inlineLanguageRe = /%< *-\*- *{lang}\d* *-\*-[\s\S]+?%>/.source;
inlineLanguages.forEach(function (lang) {
var alias = lang;
}
}(Prism));
+
return Prism; })
\ No newline at end of file
pattern: /(^|[^\\])#.*/,
lookbehind: true
},
+ 'string-interpolation': {
+ pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
+ greedy: true,
+ inside: {
+ 'interpolation': {
+ // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
+ pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,
+ lookbehind: true,
+ inside: {
+ 'format-spec': {
+ pattern: /(:)[^:(){}]+(?=}$)/,
+ lookbehind: true
+ },
+ 'conversion-option': {
+ pattern: /![sra](?=[:}]$)/,
+ alias: 'punctuation'
+ },
+ rest: null
+ }
+ },
+ 'string': /[\s\S]+/
+ }
+ },
'triple-quoted-string': {
- pattern: /("""|''')[\s\S]+?\1/,
+ pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]+?\1/i,
greedy: true,
alias: 'string'
},
'string': {
- pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
+ pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
greedy: true
},
'function': {
pattern: /(\bclass\s+)\w+/i,
lookbehind: true
},
- 'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|pass|print|raise|return|try|while|with|yield)\b/,
- 'builtin':/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
+ 'decorator': {
+ pattern: /(^\s*)@\w+(?:\.\w+)*/i,
+ lookbehind: true,
+ alias: ['annotation', 'punctuation'],
+ inside: {
+ 'punctuation': /\./
+ }
+ },
+ 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
+ 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
'boolean': /\b(?:True|False|None)\b/,
'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
- 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
+ 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
'punctuation': /[{}[\];(),.:]/
};
+Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
+
+Prism.languages.py = Prism.languages.python;
return Prism; })
\ No newline at end of file
// 'class-name' must be matched *after* 'constructor' defined below
'class-name': /\b[A-Z]\w*/,
'keyword': /\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,
- 'operator': /\.{3}|:[:=]|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:mod|land|lor|lxor|lsl|lsr|asr)\b/
+ 'operator': /\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:mod|land|lor|lxor|lsl|lsr|asr)\b/
});
Prism.languages.insertBefore('reason', 'class-name', {
'character': {
--- /dev/null
+define(["prism/prism","prism/components/prism-actionscript","prism/components/prism-coffeescript","prism/components/prism-flow","prism/components/prism-javascript","prism/components/prism-typescript","prism/components/prism-vala"], function () {
+(function (Prism) {
+
+ var specialEscape = {
+ pattern: /\\[\\(){}[\]^$+*?|.]/,
+ alias: 'escape'
+ };
+ var escape = /\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|c[a-zA-Z]|0[0-7]{0,2}|[123][0-7]{2}|.)/
+ var charClass = /\\[wsd]|\.|\\p{[^{}]+}/i
+
+ var rangeChar = '(?:[^\\\\-]|' + escape.source + ')';
+ var range = RegExp(rangeChar + '-' + rangeChar);
+
+ // the name of a capturing group
+ var groupName = {
+ pattern: /(<|')[^<>']+(?=[>']$)/,
+ lookbehind: true,
+ alias: 'variable'
+ };
+
+ var backreference = [
+ /\\(?![123][0-7]{2})[1-9]/, // a backreference which is not an octal escape
+ {
+ pattern: /\\k<[^<>']+>/,
+ inside: {
+ 'group-name': groupName
+ }
+ }
+ ];
+
+ Prism.languages.regex = {
+ 'charset': {
+ pattern: /((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,
+ lookbehind: true,
+ inside: {
+ 'charset-negation': {
+ pattern: /(^\[)\^/,
+ lookbehind: true,
+ },
+ 'charset-punctuation': /^\[|\]$/,
+ 'range': {
+ pattern: range,
+ inside: {
+ 'escape': escape,
+ 'range-punctuation': /-/
+ }
+ },
+ 'special-escape': specialEscape,
+ 'charclass': charClass,
+ 'backreference': backreference,
+ 'escape': escape
+ }
+ },
+ 'special-escape': specialEscape,
+ 'charclass': charClass,
+ 'backreference': backreference,
+ 'anchor': /[$^]|\\[ABbGZz]/,
+ 'escape': escape,
+ 'group': [
+ {
+ // https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html
+ // https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference?view=netframework-4.7.2#grouping-constructs
+
+ // (), (?<name>), (?'name'), (?>), (?:), (?=), (?!), (?<=), (?<!), (?is-m), (?i-m:)
+ pattern: /\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,
+ inside: {
+ 'group-name': groupName
+ }
+ },
+ /\)/
+ ],
+ 'quantifier': /[+*?]|\{(?:\d+,?\d*)\}/,
+ 'alternation': /\|/
+ };
+
+
+ [
+ 'actionscript',
+ 'coffescript',
+ 'flow',
+ 'javascript',
+ 'typescript',
+ 'vala'
+ ].forEach(function (lang) {
+ var grammar = Prism.languages[lang];
+ if (grammar) {
+ grammar['regex'].inside = {
+ 'regex-flags': /[a-z]+$/,
+ 'regex-delimiter': /^\/|\/$/,
+ 'language-regex': {
+ pattern: /[\s\S]+/,
+ inside: Prism.languages.regex
+ }
+ };
+ }
+ });
+
+}(Prism))
+
+return Prism; })
\ No newline at end of file
'comment': [
/#.*/,
{
- pattern: /^=begin(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?=end/m,
+ pattern: /^=begin\s[\s\S]*?^=end/m,
greedy: true
}
],
}
};
+ delete Prism.languages.ruby.function;
+
Prism.languages.insertBefore('ruby', 'keyword', {
'regex': [
{
'symbol': {
pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/,
lookbehind: true
+ },
+ 'method-definition': {
+ pattern: /(\bdef\s+)[\w.]+/,
+ lookbehind: true,
+ inside: {
+ 'function': /\w+$/,
+ rest: Prism.languages.ruby
+ }
}
});
}
}
];
+
+ Prism.languages.rb = Prism.languages.ruby;
}(Prism));
+
return Prism; })
\ No newline at end of file
pattern: /'[^\s>']+/,
alias: 'symbol'
},
- 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/,
+ 'keyword': /\b(?:abstract|alignof|as|async|await|be|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|Self|struct|super|true|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,
'attribute': {
pattern: /#!?\[.+?\]/,
'operator': /[&*]/
}
},
- 'punctuation': /[{}[\];(),:]|\.+|->/,
- 'operator': /[-+*\/%!^]=?|=[=>]?|@|&[&=]?|\|[|=]?|<<?=?|>>?=?/
+ 'punctuation': /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,
+ 'operator': /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/
};
+
return Prism; })
\ No newline at end of file
pattern: /(["'])(?:\1\1|(?!\1)[\s\S])*\1/,
greedy: true
},
- 'keyword': /\b(?:data|else|format|if|input|proc\s\w+|quit|run|then)\b/i,
+ 'keyword': /\b(?:data|else|format|if|input|proc\s\w+|quit|run|then|libname|set|output|options)\b/i,
// Decimal (1.2e23), hexadecimal (0c1x)
'number': /\b(?:[\da-f]+x|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,
'operator': /\*\*?|\|\|?|!!?|¦¦?|<[>=]?|>[<=]?|[-+\/=&]|[~¬^]=?|\b(?:eq|ne|gt|lt|ge|le|in|not)\b/i,
// Now that whole lines for other patterns are consumed,
// what's left should be selectors
- delete Prism.languages.sass.selector;
Prism.languages.insertBefore('sass', 'punctuation', {
'selector': {
pattern: /([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,
define(["prism/prism"], function () {
Prism.languages.scheme = {
- 'comment' : /;.*/,
- 'string' : {
- pattern: /"(?:[^"\\\r\n]|\\.)*"|'[^('\s]*/,
+ 'comment': /;.*/,
+ 'string': {
+ pattern: /"(?:[^"\\]|\\.)*"|'[^()#'\s]+/,
greedy: true
},
- 'keyword' : {
- pattern : /(\()(?:define(?:-syntax|-library|-values)?|(?:case-)?lambda|let(?:\*|rec)?(?:-values)?|else|if|cond|begin|delay(?:-force)?|parameterize|guard|set!|(?:quasi-)?quote|syntax-rules)/,
- lookbehind : true
+ 'character': {
+ pattern: /#\\(?:[ux][a-fA-F\d]+|[a-zA-Z]+|\S)/,
+ alias: 'string'
},
- 'builtin' : {
- pattern : /(\()(?:(?:cons|car|cdr|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?)/,
- lookbehind : true
+ 'keyword': {
+ pattern: /(\()(?:define(?:-syntax|-library|-values)?|(?:case-)?lambda|let(?:\*|rec)?(?:-values)?|else|if|cond|begin|delay(?:-force)?|parameterize|guard|set!|(?:quasi-)?quote|syntax-rules)(?=[()\s])/,
+ lookbehind: true
+ },
+ 'builtin': {
+ pattern: /(\()(?:(?:cons|car|cdr|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?)(?=[()\s])/,
+ lookbehind: true
},
- 'number' : {
- pattern: /(\s|[()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,
+ 'number': {
+ pattern: /([\s()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,
lookbehind: true
},
- 'boolean' : /#[tf]/,
+ 'boolean': /#[tf]/,
'operator': {
- pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)/,
+ pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)(?=\s|$)/,
lookbehind: true
},
- 'function' : {
- pattern : /(\()[^\s()]*(?=[\s)])/,
- lookbehind : true
+ 'function': {
+ pattern: /(\()[^()'\s]+(?=[()\s)]|$)/,
+ lookbehind: true
},
- 'punctuation' : /[()]/
+ 'punctuation': /[()']/
};
+
return Prism; })
\ No newline at end of file
}
},
// url, compassified
- 'url': /(?:[-a-z]+-)*url(?=\()/i,
+ 'url': /(?:[-a-z]+-)?url(?=\()/i,
// CSS selector regex is not appropriate for Sass
// since there can be lot more things (var, @ directive, nesting..)
// a selector must start at the end of a property or after a brace (end of other rules or nesting)
'placeholder': /%[-\w]+/,
'variable': /\$[-\w]+|#\{\$[-\w]+\}/
}
+ },
+ 'property': {
+ pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/,
+ inside: {
+ 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
+ }
}
});
]
});
-Prism.languages.scss.property = {
- pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/i,
- inside: {
- 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
- }
-};
-
Prism.languages.insertBefore('scss', 'important', {
// var and interpolated vars
'variable': /\$[-\w]+|#\{\$[-\w]+\}/
alias: 'keyword'
},
'boolean': /\b(?:true|false)\b/,
- 'null': /\bnull\b/,
+ 'null': {
+ pattern: /\bnull\b/,
+ alias: 'keyword'
+ },
'operator': {
pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
lookbehind: true
--- /dev/null
+define(["prism/prism","prism/components/prism-bash"], function () {
+Prism.languages['shell-session'] = {
+ 'command': {
+ pattern: /\$(?:[^\r\n'"<]|(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1|((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*(?:\r\n?|\n)(?:[\s\S])*?(?:\r\n?|\n)\3)+/,
+ inside: {
+ 'bash': {
+ pattern: /(\$\s*)[\s\S]+/,
+ lookbehind: true,
+ alias: 'language-bash',
+ inside: Prism.languages.bash
+ },
+ 'sh': {
+ pattern: /^\$/,
+ alias: 'important'
+ }
+ }
+ },
+ 'output': {
+ pattern: /.(?:.*(?:\r\n?|\n|.$))*/
+ // output highlighting?
+ }
+}
+
+return Prism; })
\ No newline at end of file
define(["prism/prism"], function () {
Prism.languages.smalltalk = {
- 'comment': /"(?:""|[^"])+"/,
- 'string': /'(?:''|[^'])+'/,
+ 'comment': /"(?:""|[^"])*"/,
+ 'string': /'(?:''|[^'])*'/,
'symbol': /#[\da-z]+|#(?:-|([+\/\\*~<>=@%|&?!])\1?)|#(?=\()/i,
'block-arguments': {
pattern: /(\[\s*):[^\[|]*\|/,
'operator': /[<=]=?|:=|~[~=]|\/\/?|\\\\|>[>=]?|[!^+\-*&|,@]/,
'punctuation': /[.;:?\[\](){}]/
};
+
return Prism; })
\ No newline at end of file
'keyword': /\b(?:false|off|on|no|true|yes)\b/
};
- // Comments are inserted at top so that they can
- // surround markup
- Prism.languages.insertBefore('smarty', 'tag', {
- 'smarty-comment': {
- pattern: /\{\*[\s\S]*?\*\}/,
- alias: ['smarty','comment']
- }
- });
-
// Tokenize all inline Smarty expressions
Prism.hooks.add('before-tokenize', function(env) {
var smartyPattern = /\{\*[\s\S]*?\*\}|\{[\s\S]+?\}/g;
--- /dev/null
+define(["prism/prism","prism/components/prism-t4-templating","prism/components/prism-csharp"], function () {
+Prism.languages.t4 = Prism.languages['t4-cs'] = Prism.languages['t4-templating'].createT4('csharp');
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism"], function () {
+(function (Prism) {
+
+ function createBlock(prefix, inside, contentAlias) {
+ return {
+ pattern: RegExp('<#' + prefix + '[\\s\\S]*?#>'),
+ alias: 'block',
+ inside: {
+ 'delimiter': {
+ pattern: RegExp('^<#' + prefix + '|#>$'),
+ alias: 'important'
+ },
+ 'content': {
+ pattern: /[\s\S]+/,
+ inside: inside,
+ alias: contentAlias
+ }
+ }
+ };
+ }
+
+ function createT4(insideLang) {
+ var grammar = Prism.languages[insideLang];
+ var className = 'language-' + insideLang;
+
+ return {
+ 'block': {
+ pattern: /<#[\s\S]+?#>/,
+ inside: {
+ 'directive': createBlock('@', {
+ 'attr-value': {
+ pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/,
+ inside: {
+ 'punctuation': /^=|^["']|["']$/
+ }
+ },
+ 'keyword': /\w+(?=\s)/,
+ 'attr-name': /\w+/
+ }),
+ 'expression': createBlock('=', grammar, className),
+ 'class-feature': createBlock('\\+', grammar, className),
+ 'standard': createBlock('', grammar, className)
+ }
+ }
+ };
+ }
+
+ Prism.languages['t4-templating'] = Object.defineProperty({}, 'createT4', { value: createT4 });
+
+}(Prism));
+
+return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-t4-templating","prism/components/prism-visual-basic"], function () {
+Prism.languages['t4-vb'] = Prism.languages['t4-templating'].createT4('visual-basic');
+
+return Prism; })
\ No newline at end of file
define(["prism/prism","prism/components/prism-markup","prism/components/prism-css"], function () {
-(function(Prism) {
+(function (Prism) {
// We don't allow for pipes inside parentheses
// to not break table pattern |(. foo |). bar |
- var modifierRegex = '(?:\\([^|)]+\\)|\\[[^\\]]+\\]|\\{[^}]+\\})+';
+ var modifierRegex = /(?:\([^|)]+\)|\[[^\]]+\]|\{[^}]+\})+/.source;
var modifierTokens = {
'css': {
pattern: /\{[^}]+\}/,
};
- Prism.languages.textile = Prism.languages.extend('markup', {
+ var textile = Prism.languages.textile = Prism.languages.extend('markup', {
'phrase': {
pattern: /(^|\r|\n)\S[\s\S]*?(?=$|\r?\n\r?\n|\r\r)/,
lookbehind: true,
pattern: /\b\((?:TM|R|C)\)/,
alias: 'comment',
inside: {
- 'punctuation':/[()]/
+ 'punctuation': /[()]/
}
}
}
}
});
+ var phraseInside = textile['phrase'].inside;
var nestedPatterns = {
- 'inline': Prism.languages.textile['phrase'].inside['inline'],
- 'link': Prism.languages.textile['phrase'].inside['link'],
- 'image': Prism.languages.textile['phrase'].inside['image'],
- 'footnote': Prism.languages.textile['phrase'].inside['footnote'],
- 'acronym': Prism.languages.textile['phrase'].inside['acronym'],
- 'mark': Prism.languages.textile['phrase'].inside['mark']
+ 'inline': phraseInside['inline'],
+ 'link': phraseInside['link'],
+ 'image': phraseInside['image'],
+ 'footnote': phraseInside['footnote'],
+ 'acronym': phraseInside['acronym'],
+ 'mark': phraseInside['mark']
};
// Only allow alpha-numeric HTML tags, not XML tags
- Prism.languages.textile.tag.pattern = /<\/?(?!\d)[a-z0-9]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i;
+ textile.tag.pattern = /<\/?(?!\d)[a-z0-9]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i;
// Allow some nesting
- Prism.languages.textile['phrase'].inside['inline'].inside['bold'].inside = nestedPatterns;
- Prism.languages.textile['phrase'].inside['inline'].inside['italic'].inside = nestedPatterns;
- Prism.languages.textile['phrase'].inside['inline'].inside['inserted'].inside = nestedPatterns;
- Prism.languages.textile['phrase'].inside['inline'].inside['deleted'].inside = nestedPatterns;
- Prism.languages.textile['phrase'].inside['inline'].inside['span'].inside = nestedPatterns;
+ var phraseInlineInside = phraseInside['inline'].inside;
+ phraseInlineInside['bold'].inside = nestedPatterns;
+ phraseInlineInside['italic'].inside = nestedPatterns;
+ phraseInlineInside['inserted'].inside = nestedPatterns;
+ phraseInlineInside['deleted'].inside = nestedPatterns;
+ phraseInlineInside['span'].inside = nestedPatterns;
// Allow some styles inside table cells
- Prism.languages.textile['phrase'].inside['table'].inside['inline'] = nestedPatterns['inline'];
- Prism.languages.textile['phrase'].inside['table'].inside['link'] = nestedPatterns['link'];
- Prism.languages.textile['phrase'].inside['table'].inside['image'] = nestedPatterns['image'];
- Prism.languages.textile['phrase'].inside['table'].inside['footnote'] = nestedPatterns['footnote'];
- Prism.languages.textile['phrase'].inside['table'].inside['acronym'] = nestedPatterns['acronym'];
- Prism.languages.textile['phrase'].inside['table'].inside['mark'] = nestedPatterns['mark'];
+ var phraseTableInside = phraseInside['table'].inside;
+ phraseTableInside['inline'] = nestedPatterns['inline'];
+ phraseTableInside['link'] = nestedPatterns['link'];
+ phraseTableInside['image'] = nestedPatterns['image'];
+ phraseTableInside['footnote'] = nestedPatterns['footnote'];
+ phraseTableInside['acronym'] = nestedPatterns['acronym'];
+ phraseTableInside['mark'] = nestedPatterns['mark'];
}(Prism));
+
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism"], function () {
+(function (Prism) {
+
+ // pattern: /(?:[\w-]+|'[^'\n\r]*'|"(?:\.|[^\\"\r\n])*")/
+ var key = "(?:[\\w-]+|'[^'\n\r]*'|\"(?:\\.|[^\\\\\"\r\n])*\")";
+
+ Prism.languages.toml = {
+ 'comment': {
+ pattern: /#.*/,
+ greedy: true
+ },
+ 'table': {
+ pattern: RegExp("(^\\s*\\[\\s*(?:\\[\\s*)?)" + key + "(?:\\s*\\.\\s*" + key + ")*(?=\\s*\\])", "m"),
+ lookbehind: true,
+ greedy: true,
+ alias: 'class-name'
+ },
+ 'key': {
+ pattern: RegExp("(^\\s*|[{,]\\s*)" + key + "(?:\\s*\\.\\s*" + key + ")*(?=\\s*=)", "m"),
+ lookbehind: true,
+ greedy: true,
+ alias: 'property'
+ },
+ 'string': {
+ pattern: /"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,
+ greedy: true
+ },
+ 'date': [
+ {
+ // Offset Date-Time, Local Date-Time, Local Date
+ pattern: /\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?/i,
+ alias: 'number'
+ },
+ {
+ // Local Time
+ pattern: /\d{2}:\d{2}:\d{2}(?:\.\d+)?/i,
+ alias: 'number'
+ }
+ ],
+ 'number': /(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?(?:inf|nan)\b/,
+ 'boolean': /\b(?:true|false)\b/,
+ 'punctuation': /[.,=[\]{}]/
+ };
+}(Prism));
+
+return Prism; })
\ No newline at end of file
(function(Prism) {
Prism.languages.tt2 = Prism.languages.extend('clike', {
- comment: {
- pattern: /#.*|\[%#[\s\S]*?%\]/,
- lookbehind: true
- },
- keyword: /\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|TAGS|THROW|TRY|SWITCH|UNLESS|USE|WHILE|WRAPPER)\b/,
- punctuation: /[[\]{},()]/
+ 'comment': /#.*|\[%#[\s\S]*?%\]/,
+ 'keyword': /\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|TAGS|THROW|TRY|SWITCH|UNLESS|USE|WHILE|WRAPPER)\b/,
+ 'punctuation': /[[\]{},()]/
});
- delete Prism.languages.tt2['operator'];
- delete Prism.languages.tt2['variable'];
Prism.languages.insertBefore('tt2', 'number', {
- operator: /=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|or|not)\b/,
- variable: {
+ 'operator': /=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|or|not)\b/,
+ 'variable': {
pattern: /[a-z]\w*(?:\s*\.\s*(?:\d+|\$?[a-z]\w*))*/i
}
});
- delete Prism.languages.tt2['delimiter'];
Prism.languages.insertBefore('tt2', 'keyword', {
'delimiter': {
pattern: /^(?:\[%|%%)-?|-?%]$/,
greedy: true,
alias: 'string',
inside: {
- variable: {
+ 'variable': {
pattern: /\$(?:[a-z]\w*(?:\.(?:\d+|\$?[a-z]\w*))*)/i
}
}
'rd': {
pattern: /-?(?:%\}|\}\})$/,
inside: {
- 'punctuation': /.*/
+ 'punctuation': /.+/
}
},
'string': {
define(["prism/prism","prism/components/prism-javascript"], function () {
Prism.languages.typescript = Prism.languages.extend('javascript', {
// From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words
- 'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield|module|declare|constructor|namespace|abstract|require|type)\b/,
- 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console)\b/,
+ 'keyword': /\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,
+ 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/,
});
Prism.languages.ts = Prism.languages.typescript;
+
return Prism; })
\ No newline at end of file
--- /dev/null
+define(["prism/prism","prism/components/prism-clike"], function () {
+Prism.languages.vala = Prism.languages.extend('clike', {
+ // Classes copied from prism-csharp
+ 'class-name': [
+ {
+ // (Foo bar, Bar baz)
+ pattern: /\b[A-Z]\w*(?:\.\w+)*\b(?=(?:\?\s+|\*?\s+\*?)\w+)/,
+ inside: {
+ punctuation: /\./
+ }
+ },
+ {
+ // [Foo]
+ pattern: /(\[)[A-Z]\w*(?:\.\w+)*\b/,
+ lookbehind: true,
+ inside: {
+ punctuation: /\./
+ }
+ },
+ {
+ // class Foo : Bar
+ pattern: /(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,
+ lookbehind: true,
+ inside: {
+ punctuation: /\./
+ }
+ },
+ {
+ // class Foo
+ pattern: /((?:\b(?:class|interface|new|struct|enum)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,
+ lookbehind: true,
+ inside: {
+ punctuation: /\./
+ }
+ }
+ ],
+ 'constant': /\b[A-Z0-9_]+\b/,
+ 'function': /\w+(?=\s*\()/,
+ 'keyword': /\b(?:bool|char|double|float|null|size_t|ssize_t|string|unichar|void|int|int8|int16|int32|int64|long|short|uchar|uint|uint8|uint16|uint32|uint64|ulong|ushort|class|delegate|enum|errordomain|interface|namespace|struct|break|continue|do|for|foreach|return|while|else|if|switch|assert|case|default|abstract|const|dynamic|ensures|extern|inline|internal|override|private|protected|public|requires|signal|static|virtual|volatile|weak|async|owned|unowned|try|catch|finally|throw|as|base|construct|delete|get|in|is|lock|new|out|params|ref|sizeof|set|this|throws|typeof|using|value|var|yield)\b/i,
+ 'number': /(?:\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)(?:f|u?l?)?/i,
+ 'operator': /\+\+|--|&&|\|\||<<=?|>>=?|=>|->|~|[+\-*\/%&^|=!<>]=?|\?\??|\.\.\./,
+ 'punctuation': /[{}[\];(),.:]/
+});
+
+Prism.languages.insertBefore('vala','string', {
+ 'raw-string': {
+ pattern: /"""[\s\S]*?"""/,
+ greedy: true,
+ alias: 'string'
+ },
+ 'template-string': {
+ pattern: /@"[\s\S]*?"/,
+ greedy: true,
+ inside: {
+ 'interpolation': {
+ pattern: /\$(?:\([^)]*\)|[a-zA-Z]\w*)/,
+ inside: {
+ 'delimiter': {
+ pattern: /^\$\(?|\)$/,
+ alias: 'punctuation'
+ },
+ rest: Prism.languages.vala
+ }
+ },
+ 'string': /[\s\S]+/
+ }
+ }
+});
+
+Prism.languages.insertBefore('vala', 'keyword', {
+ 'regex': {
+ pattern: /\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[imsx]{0,4}(?=\s*($|[\r\n,.;})\]]))/,
+ greedy: true
+ }
+});
+return Prism; })
\ No newline at end of file
alias: 'important'
},
'string': {
- pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)("|')(?:(?!\2)[^\\\r\n]|\\.)*\2(?=[ \t]*(?:$|,|]|}))/m,
+ pattern: /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)("|')(?:(?!\2)[^\\\r\n]|\\.)*\2(?=[ \t]*(?:$|,|]|}|\s*#))/m,
lookbehind: true,
greedy: true
},
'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
};
+Prism.languages.yml = Prism.languages.yaml;
return Prism; })
\ No newline at end of file
-define([],function(){return /*START*/{"markup":{"title":"Markup","file":"markup"},"html":{"title":"HTML","file":"markup"},"xml":{"title":"XML","file":"markup"},"svg":{"title":"SVG","file":"markup"},"mathml":{"title":"MathML","file":"markup"},"css":{"title":"CSS","file":"css"},"clike":{"title":"C-like","file":"clike"},"javascript":{"title":"JavaScript","file":"javascript"},"abap":{"title":"ABAP","file":"abap"},"actionscript":{"title":"ActionScript","file":"actionscript"},"ada":{"title":"Ada","file":"ada"},"apacheconf":{"title":"Apache Configuration","file":"apacheconf"},"apl":{"title":"APL","file":"apl"},"applescript":{"title":"AppleScript","file":"applescript"},"arduino":{"title":"Arduino","file":"arduino"},"arff":{"title":"ARFF","file":"arff"},"asciidoc":{"title":"AsciiDoc","file":"asciidoc"},"asm6502":{"title":"6502 Assembly","file":"asm6502"},"aspnet":{"title":"ASP.NET (C#)","file":"aspnet"},"autohotkey":{"title":"AutoHotkey","file":"autohotkey"},"autoit":{"title":"AutoIt","file":"autoit"},"bash":{"title":"Bash","file":"bash"},"basic":{"title":"BASIC","file":"basic"},"batch":{"title":"Batch","file":"batch"},"bison":{"title":"Bison","file":"bison"},"brainfuck":{"title":"Brainfuck","file":"brainfuck"},"bro":{"title":"Bro","file":"bro"},"c":{"title":"C","file":"c"},"csharp":{"title":"C#","file":"csharp"},"cpp":{"title":"C++","file":"cpp"},"coffeescript":{"title":"CoffeeScript","file":"coffeescript"},"clojure":{"title":"Clojure","file":"clojure"},"crystal":{"title":"Crystal","file":"crystal"},"csp":{"title":"Content-Security-Policy","file":"csp"},"css-extras":{"title":"CSS Extras","file":"css-extras"},"d":{"title":"D","file":"d"},"dart":{"title":"Dart","file":"dart"},"diff":{"title":"Diff","file":"diff"},"django":{"title":"Django/Jinja2","file":"django"},"docker":{"title":"Docker","file":"docker"},"eiffel":{"title":"Eiffel","file":"eiffel"},"elixir":{"title":"Elixir","file":"elixir"},"elm":{"title":"Elm","file":"elm"},"erb":{"title":"ERB","file":"erb"},"erlang":{"title":"Erlang","file":"erlang"},"fsharp":{"title":"F#","file":"fsharp"},"flow":{"title":"Flow","file":"flow"},"fortran":{"title":"Fortran","file":"fortran"},"gedcom":{"title":"GEDCOM","file":"gedcom"},"gherkin":{"title":"Gherkin","file":"gherkin"},"git":{"title":"Git","file":"git"},"glsl":{"title":"GLSL","file":"glsl"},"gml":{"title":"GameMaker Language","file":"gml"},"go":{"title":"Go","file":"go"},"graphql":{"title":"GraphQL","file":"graphql"},"groovy":{"title":"Groovy","file":"groovy"},"haml":{"title":"Haml","file":"haml"},"handlebars":{"title":"Handlebars","file":"handlebars"},"haskell":{"title":"Haskell","file":"haskell"},"haxe":{"title":"Haxe","file":"haxe"},"http":{"title":"HTTP","file":"http"},"hpkp":{"title":"HTTP Public-Key-Pins","file":"hpkp"},"hsts":{"title":"HTTP Strict-Transport-Security","file":"hsts"},"ichigojam":{"title":"IchigoJam","file":"ichigojam"},"icon":{"title":"Icon","file":"icon"},"inform7":{"title":"Inform 7","file":"inform7"},"ini":{"title":"Ini","file":"ini"},"io":{"title":"Io","file":"io"},"j":{"title":"J","file":"j"},"java":{"title":"Java","file":"java"},"jolie":{"title":"Jolie","file":"jolie"},"json":{"title":"JSON","file":"json"},"julia":{"title":"Julia","file":"julia"},"keyman":{"title":"Keyman","file":"keyman"},"kotlin":{"title":"Kotlin","file":"kotlin"},"latex":{"title":"LaTeX","file":"latex"},"less":{"title":"Less","file":"less"},"liquid":{"title":"Liquid","file":"liquid"},"lisp":{"title":"Lisp","file":"lisp"},"livescript":{"title":"LiveScript","file":"livescript"},"lolcode":{"title":"LOLCODE","file":"lolcode"},"lua":{"title":"Lua","file":"lua"},"makefile":{"title":"Makefile","file":"makefile"},"markdown":{"title":"Markdown","file":"markdown"},"markup-templating":{"title":"Markup templating","file":"markup-templating"},"matlab":{"title":"MATLAB","file":"matlab"},"mel":{"title":"MEL","file":"mel"},"mizar":{"title":"Mizar","file":"mizar"},"monkey":{"title":"Monkey","file":"monkey"},"n4js":{"title":"N4JS","file":"n4js"},"nasm":{"title":"NASM","file":"nasm"},"nginx":{"title":"nginx","file":"nginx"},"nim":{"title":"Nim","file":"nim"},"nix":{"title":"Nix","file":"nix"},"nsis":{"title":"NSIS","file":"nsis"},"objectivec":{"title":"Objective-C","file":"objectivec"},"ocaml":{"title":"OCaml","file":"ocaml"},"opencl":{"title":"OpenCL","file":"opencl"},"oz":{"title":"Oz","file":"oz"},"parigp":{"title":"PARI/GP","file":"parigp"},"parser":{"title":"Parser","file":"parser"},"pascal":{"title":"Pascal","file":"pascal"},"perl":{"title":"Perl","file":"perl"},"php":{"title":"PHP","file":"php"},"php-extras":{"title":"PHP Extras","file":"php-extras"},"plsql":{"title":"PL/SQL","file":"plsql"},"powershell":{"title":"PowerShell","file":"powershell"},"processing":{"title":"Processing","file":"processing"},"prolog":{"title":"Prolog","file":"prolog"},"properties":{"title":".properties","file":"properties"},"protobuf":{"title":"Protocol Buffers","file":"protobuf"},"pug":{"title":"Pug","file":"pug"},"puppet":{"title":"Puppet","file":"puppet"},"pure":{"title":"Pure","file":"pure"},"python":{"title":"Python","file":"python"},"q":{"title":"Q (kdb+ database)","file":"q"},"qore":{"title":"Qore","file":"qore"},"r":{"title":"R","file":"r"},"jsx":{"title":"React JSX","file":"jsx"},"tsx":{"title":"React TSX","file":"tsx"},"renpy":{"title":"Ren'py","file":"renpy"},"reason":{"title":"Reason","file":"reason"},"rest":{"title":"reST (reStructuredText)","file":"rest"},"rip":{"title":"Rip","file":"rip"},"roboconf":{"title":"Roboconf","file":"roboconf"},"ruby":{"title":"Ruby","file":"ruby"},"rust":{"title":"Rust","file":"rust"},"sas":{"title":"SAS","file":"sas"},"sass":{"title":"Sass (Sass)","file":"sass"},"scss":{"title":"Sass (Scss)","file":"scss"},"scala":{"title":"Scala","file":"scala"},"scheme":{"title":"Scheme","file":"scheme"},"smalltalk":{"title":"Smalltalk","file":"smalltalk"},"smarty":{"title":"Smarty","file":"smarty"},"sql":{"title":"SQL","file":"sql"},"soy":{"title":"Soy (Closure Template)","file":"soy"},"stylus":{"title":"Stylus","file":"stylus"},"swift":{"title":"Swift","file":"swift"},"tap":{"title":"TAP","file":"tap"},"tcl":{"title":"Tcl","file":"tcl"},"textile":{"title":"Textile","file":"textile"},"tt2":{"title":"Template Toolkit 2","file":"tt2"},"twig":{"title":"Twig","file":"twig"},"typescript":{"title":"TypeScript","file":"typescript"},"vbnet":{"title":"VB.Net","file":"vbnet"},"velocity":{"title":"Velocity","file":"velocity"},"verilog":{"title":"Verilog","file":"verilog"},"vhdl":{"title":"VHDL","file":"vhdl"},"vim":{"title":"vim","file":"vim"},"visual-basic":{"title":"Visual Basic","file":"visual-basic"},"wasm":{"title":"WebAssembly","file":"wasm"},"wiki":{"title":"Wiki markup","file":"wiki"},"xeora":{"title":"Xeora","file":"xeora"},"xojo":{"title":"Xojo (REALbasic)","file":"xojo"},"xquery":{"title":"XQuery","file":"xquery"},"yaml":{"title":"YAML","file":"yaml"}}/*END*/;});
\ No newline at end of file
+define([],function(){return /*START*/{"markup":{"title":"Markup","file":"markup"},"html":{"title":"HTML","file":"markup"},"xml":{"title":"XML","file":"markup"},"svg":{"title":"SVG","file":"markup"},"mathml":{"title":"MathML","file":"markup"},"css":{"title":"CSS","file":"css"},"clike":{"title":"C-like","file":"clike"},"javascript":{"title":"JavaScript","file":"javascript"},"abap":{"title":"ABAP","file":"abap"},"abnf":{"title":"Augmented Backus–Naur form","file":"abnf"},"actionscript":{"title":"ActionScript","file":"actionscript"},"ada":{"title":"Ada","file":"ada"},"apacheconf":{"title":"Apache Configuration","file":"apacheconf"},"apl":{"title":"APL","file":"apl"},"applescript":{"title":"AppleScript","file":"applescript"},"arduino":{"title":"Arduino","file":"arduino"},"arff":{"title":"ARFF","file":"arff"},"asciidoc":{"title":"AsciiDoc","file":"asciidoc"},"asm6502":{"title":"6502 Assembly","file":"asm6502"},"aspnet":{"title":"ASP.NET (C#)","file":"aspnet"},"autohotkey":{"title":"AutoHotkey","file":"autohotkey"},"autoit":{"title":"AutoIt","file":"autoit"},"bash":{"title":"Bash","file":"bash"},"basic":{"title":"BASIC","file":"basic"},"batch":{"title":"Batch","file":"batch"},"bison":{"title":"Bison","file":"bison"},"bnf":{"title":"Backus–Naur form","file":"bnf"},"brainfuck":{"title":"Brainfuck","file":"brainfuck"},"bro":{"title":"Bro","file":"bro"},"c":{"title":"C","file":"c"},"csharp":{"title":"C#","file":"csharp"},"cpp":{"title":"C++","file":"cpp"},"cil":{"title":"CIL","file":"cil"},"coffeescript":{"title":"CoffeeScript","file":"coffeescript"},"cmake":{"title":"CMake","file":"cmake"},"clojure":{"title":"Clojure","file":"clojure"},"crystal":{"title":"Crystal","file":"crystal"},"csp":{"title":"Content-Security-Policy","file":"csp"},"css-extras":{"title":"CSS Extras","file":"css-extras"},"d":{"title":"D","file":"d"},"dart":{"title":"Dart","file":"dart"},"diff":{"title":"Diff","file":"diff"},"django":{"title":"Django/Jinja2","file":"django"},"docker":{"title":"Docker","file":"docker"},"ebnf":{"title":"Extended Backus–Naur form","file":"ebnf"},"eiffel":{"title":"Eiffel","file":"eiffel"},"ejs":{"title":"EJS","file":"ejs"},"elixir":{"title":"Elixir","file":"elixir"},"elm":{"title":"Elm","file":"elm"},"erb":{"title":"ERB","file":"erb"},"erlang":{"title":"Erlang","file":"erlang"},"fsharp":{"title":"F#","file":"fsharp"},"flow":{"title":"Flow","file":"flow"},"fortran":{"title":"Fortran","file":"fortran"},"gcode":{"title":"G-code","file":"gcode"},"gedcom":{"title":"GEDCOM","file":"gedcom"},"gherkin":{"title":"Gherkin","file":"gherkin"},"git":{"title":"Git","file":"git"},"glsl":{"title":"GLSL","file":"glsl"},"gml":{"title":"GameMaker Language","file":"gml"},"go":{"title":"Go","file":"go"},"graphql":{"title":"GraphQL","file":"graphql"},"groovy":{"title":"Groovy","file":"groovy"},"haml":{"title":"Haml","file":"haml"},"handlebars":{"title":"Handlebars","file":"handlebars"},"haskell":{"title":"Haskell","file":"haskell"},"haxe":{"title":"Haxe","file":"haxe"},"hcl":{"title":"HCL","file":"hcl"},"http":{"title":"HTTP","file":"http"},"hpkp":{"title":"HTTP Public-Key-Pins","file":"hpkp"},"hsts":{"title":"HTTP Strict-Transport-Security","file":"hsts"},"ichigojam":{"title":"IchigoJam","file":"ichigojam"},"icon":{"title":"Icon","file":"icon"},"inform7":{"title":"Inform 7","file":"inform7"},"ini":{"title":"Ini","file":"ini"},"io":{"title":"Io","file":"io"},"j":{"title":"J","file":"j"},"java":{"title":"Java","file":"java"},"javadoc":{"title":"JavaDoc","file":"javadoc"},"javadoclike":{"title":"JavaDoc-like","file":"javadoclike"},"javastacktrace":{"title":"Java stack trace","file":"javastacktrace"},"jolie":{"title":"Jolie","file":"jolie"},"jq":{"title":"JQ","file":"jq"},"jsdoc":{"title":"JSDoc","file":"jsdoc"},"js-extras":{"title":"JS Extras","file":"js-extras"},"json":{"title":"JSON","file":"json"},"jsonp":{"title":"JSONP","file":"jsonp"},"json5":{"title":"JSON5","file":"json5"},"julia":{"title":"Julia","file":"julia"},"keyman":{"title":"Keyman","file":"keyman"},"kotlin":{"title":"Kotlin","file":"kotlin"},"latex":{"title":"LaTeX","file":"latex"},"tex":{"title":"TeX","file":"latex"},"context":{"title":"ConTeXt","file":"latex"},"less":{"title":"Less","file":"less"},"liquid":{"title":"Liquid","file":"liquid"},"lisp":{"title":"Lisp","file":"lisp"},"livescript":{"title":"LiveScript","file":"livescript"},"lolcode":{"title":"LOLCODE","file":"lolcode"},"lua":{"title":"Lua","file":"lua"},"makefile":{"title":"Makefile","file":"makefile"},"markdown":{"title":"Markdown","file":"markdown"},"markup-templating":{"title":"Markup templating","file":"markup-templating"},"matlab":{"title":"MATLAB","file":"matlab"},"mel":{"title":"MEL","file":"mel"},"mizar":{"title":"Mizar","file":"mizar"},"monkey":{"title":"Monkey","file":"monkey"},"n1ql":{"title":"N1QL","file":"n1ql"},"n4js":{"title":"N4JS","file":"n4js"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","file":"nand2tetris-hdl"},"nasm":{"title":"NASM","file":"nasm"},"nginx":{"title":"nginx","file":"nginx"},"nim":{"title":"Nim","file":"nim"},"nix":{"title":"Nix","file":"nix"},"nsis":{"title":"NSIS","file":"nsis"},"objectivec":{"title":"Objective-C","file":"objectivec"},"ocaml":{"title":"OCaml","file":"ocaml"},"opencl":{"title":"OpenCL","file":"opencl"},"oz":{"title":"Oz","file":"oz"},"parigp":{"title":"PARI/GP","file":"parigp"},"parser":{"title":"Parser","file":"parser"},"pascal":{"title":"Pascal","file":"pascal"},"perl":{"title":"Perl","file":"perl"},"php":{"title":"PHP","file":"php"},"phpdoc":{"title":"PHPDoc","file":"phpdoc"},"php-extras":{"title":"PHP Extras","file":"php-extras"},"plsql":{"title":"PL/SQL","file":"plsql"},"powershell":{"title":"PowerShell","file":"powershell"},"processing":{"title":"Processing","file":"processing"},"prolog":{"title":"Prolog","file":"prolog"},"properties":{"title":".properties","file":"properties"},"protobuf":{"title":"Protocol Buffers","file":"protobuf"},"pug":{"title":"Pug","file":"pug"},"puppet":{"title":"Puppet","file":"puppet"},"pure":{"title":"Pure","file":"pure"},"python":{"title":"Python","file":"python"},"q":{"title":"Q (kdb+ database)","file":"q"},"qore":{"title":"Qore","file":"qore"},"r":{"title":"R","file":"r"},"jsx":{"title":"React JSX","file":"jsx"},"tsx":{"title":"React TSX","file":"tsx"},"renpy":{"title":"Ren'py","file":"renpy"},"reason":{"title":"Reason","file":"reason"},"regex":{"title":"Regex","file":"regex"},"rest":{"title":"reST (reStructuredText)","file":"rest"},"rip":{"title":"Rip","file":"rip"},"roboconf":{"title":"Roboconf","file":"roboconf"},"ruby":{"title":"Ruby","file":"ruby"},"rust":{"title":"Rust","file":"rust"},"sas":{"title":"SAS","file":"sas"},"sass":{"title":"Sass (Sass)","file":"sass"},"scss":{"title":"Sass (Scss)","file":"scss"},"scala":{"title":"Scala","file":"scala"},"scheme":{"title":"Scheme","file":"scheme"},"shell-session":{"title":"Shell session","file":"shell-session"},"smalltalk":{"title":"Smalltalk","file":"smalltalk"},"smarty":{"title":"Smarty","file":"smarty"},"sql":{"title":"SQL","file":"sql"},"soy":{"title":"Soy (Closure Template)","file":"soy"},"stylus":{"title":"Stylus","file":"stylus"},"swift":{"title":"Swift","file":"swift"},"tap":{"title":"TAP","file":"tap"},"tcl":{"title":"Tcl","file":"tcl"},"textile":{"title":"Textile","file":"textile"},"toml":{"title":"TOML","file":"toml"},"tt2":{"title":"Template Toolkit 2","file":"tt2"},"twig":{"title":"Twig","file":"twig"},"typescript":{"title":"TypeScript","file":"typescript"},"t4-cs":{"title":"T4 Text Templates (C#)","file":"t4-cs"},"t4-vb":{"title":"T4 Text Templates (VB)","file":"t4-vb"},"t4-templating":{"title":"T4 templating","file":"t4-templating"},"vala":{"title":"Vala","file":"vala"},"vbnet":{"title":"VB.Net","file":"vbnet"},"velocity":{"title":"Velocity","file":"velocity"},"verilog":{"title":"Verilog","file":"verilog"},"vhdl":{"title":"VHDL","file":"vhdl"},"vim":{"title":"vim","file":"vim"},"visual-basic":{"title":"Visual Basic","file":"visual-basic"},"wasm":{"title":"WebAssembly","file":"wasm"},"wiki":{"title":"Wiki markup","file":"wiki"},"xeora":{"title":"Xeora","file":"xeora"},"xojo":{"title":"Xojo (REALbasic)","file":"xojo"},"xquery":{"title":"XQuery","file":"xquery"},"yaml":{"title":"YAML","file":"yaml"}}/*END*/;});
\ No newline at end of file
-/* PrismJS 1.15.0
-https://prismjs.com/download.html#themes=prism */
var _self = (typeof window !== 'undefined')
? window // if in browser
: (
* @author Lea Verou http://lea.verou.me
*/
-var Prism = (function(){
+var Prism = (function (_self){
// Private helper vars
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
var uniqueId = 0;
-var _ = _self.Prism = {
+var _ = {
manual: _self.Prism && _self.Prism.manual,
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
util: {
encode: function (tokens) {
if (tokens instanceof Token) {
return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
- } else if (_.util.type(tokens) === 'Array') {
+ } else if (Array.isArray(tokens)) {
return tokens.map(_.util.encode);
} else {
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
},
type: function (o) {
- return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
+ return Object.prototype.toString.call(o).slice(8, -1);
},
objId: function (obj) {
},
// Deep clone a language definition (e.g. to extend it)
- clone: function (o, visited) {
- var type = _.util.type(o);
+ clone: function deepClone(o, visited) {
+ var clone, id, type = _.util.type(o);
visited = visited || {};
switch (type) {
case 'Object':
- if (visited[_.util.objId(o)]) {
- return visited[_.util.objId(o)];
+ id = _.util.objId(o);
+ if (visited[id]) {
+ return visited[id];
}
- var clone = {};
- visited[_.util.objId(o)] = clone;
+ clone = {};
+ visited[id] = clone;
for (var key in o) {
if (o.hasOwnProperty(key)) {
- clone[key] = _.util.clone(o[key], visited);
+ clone[key] = deepClone(o[key], visited);
}
}
return clone;
case 'Array':
- if (visited[_.util.objId(o)]) {
- return visited[_.util.objId(o)];
+ id = _.util.objId(o);
+ if (visited[id]) {
+ return visited[id];
}
- var clone = [];
- visited[_.util.objId(o)] = clone;
+ clone = [];
+ visited[id] = clone;
o.forEach(function (v, i) {
- clone[i] = _.util.clone(v, visited);
+ clone[i] = deepClone(v, visited);
});
return clone;
- }
- return o;
+ default:
+ return o;
+ }
}
},
/**
* Insert a token before another token in a language literal
* As this needs to recreate the object (we cannot actually insert before keys in object literals),
- * we cannot just provide an object, we need anobject and a key.
+ * we cannot just provide an object, we need an object and a key.
* @param inside The key (or language id) of the parent
- * @param before The key to insert before. If not provided, the function appends instead.
+ * @param before The key to insert before.
* @param insert Object with the key/value pairs to insert
* @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
*/
insertBefore: function (inside, before, insert, root) {
root = root || _.languages;
var grammar = root[inside];
-
- if (arguments.length == 2) {
- insert = arguments[1];
-
- for (var newToken in insert) {
- if (insert.hasOwnProperty(newToken)) {
- grammar[newToken] = insert[newToken];
- }
- }
-
- return grammar;
- }
-
var ret = {};
for (var token in grammar) {
-
if (grammar.hasOwnProperty(token)) {
if (token == before) {
-
for (var newToken in insert) {
-
if (insert.hasOwnProperty(newToken)) {
ret[newToken] = insert[newToken];
}
}
}
- ret[token] = grammar[token];
+ // Do not insert token which also occur in insert. See #1525
+ if (!insert.hasOwnProperty(token)) {
+ ret[token] = grammar[token];
+ }
}
}
},
// Traverse a language definition with Depth First Search
- DFS: function(o, callback, type, visited) {
+ DFS: function DFS(o, callback, type, visited) {
visited = visited || {};
+
+ var objId = _.util.objId;
+
for (var i in o) {
if (o.hasOwnProperty(i)) {
callback.call(o, i, o[i], type || i);
- if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
- visited[_.util.objId(o[i])] = true;
- _.languages.DFS(o[i], callback, null, visited);
+ var property = o[i],
+ propertyType = _.util.type(property);
+
+ if (propertyType === 'Object' && !visited[objId(property)]) {
+ visited[objId(property)] = true;
+ DFS(property, callback, null, visited);
}
- else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
- visited[_.util.objId(o[i])] = true;
- _.languages.DFS(o[i], callback, i, visited);
+ else if (propertyType === 'Array' && !visited[objId(property)]) {
+ visited[objId(property)] = true;
+ DFS(property, callback, i, visited);
}
}
}
highlightElement: function(element, async, callback) {
// Find language
- var language, grammar, parent = element;
+ var language = 'none', grammar, parent = element;
while (parent && !lang.test(parent.className)) {
parent = parent.parentNode;
}
if (parent) {
- language = (parent.className.match(lang) || [,''])[1].toLowerCase();
+ language = (parent.className.match(lang) || [,'none'])[1].toLowerCase();
grammar = _.languages[language];
}
code: code
};
+ var insertHighlightedCode = function (highlightedCode) {
+ env.highlightedCode = highlightedCode;
+
+ _.hooks.run('before-insert', env);
+
+ env.element.innerHTML = env.highlightedCode;
+
+ _.hooks.run('after-highlight', env);
+ _.hooks.run('complete', env);
+ callback && callback.call(env.element);
+ }
+
_.hooks.run('before-sanity-check', env);
- if (!env.code || !env.grammar) {
- if (env.code) {
- _.hooks.run('before-highlight', env);
- env.element.textContent = env.code;
- _.hooks.run('after-highlight', env);
- }
+ if (!env.code) {
_.hooks.run('complete', env);
return;
}
_.hooks.run('before-highlight', env);
+ if (!env.grammar) {
+ insertHighlightedCode(_.util.encode(env.code));
+ return;
+ }
+
if (async && _self.Worker) {
var worker = new Worker(_.filename);
worker.onmessage = function(evt) {
- env.highlightedCode = evt.data;
-
- _.hooks.run('before-insert', env);
-
- env.element.innerHTML = env.highlightedCode;
-
- callback && callback.call(env.element);
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
+ insertHighlightedCode(evt.data);
};
worker.postMessage(JSON.stringify({
}));
}
else {
- env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
-
- _.hooks.run('before-insert', env);
-
- env.element.innerHTML = env.highlightedCode;
-
- callback && callback.call(element);
-
- _.hooks.run('after-highlight', env);
- _.hooks.run('complete', env);
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
}
},
},
matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
- var Token = _.Token;
-
for (var token in grammar) {
if(!grammar.hasOwnProperty(token) || !grammar[token]) {
continue;
}
},
- tokenize: function(text, grammar, language) {
+ tokenize: function(text, grammar) {
var strarr = [text];
var rest = grammar.rest;
callback(env);
}
}
- }
+ },
+
+ Token: Token
};
-var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
+_self.Prism = _;
+
+function Token(type, content, alias, matchedStr, greedy) {
this.type = type;
this.content = content;
this.alias = alias;
// Copy of the full string this token was created from
this.length = (matchedStr || "").length|0;
this.greedy = !!greedy;
-};
+}
-Token.stringify = function(o, language, parent) {
+Token.stringify = function(o, language) {
if (typeof o == 'string') {
return o;
}
- if (_.util.type(o) === 'Array') {
+ if (Array.isArray(o)) {
return o.map(function(element) {
- return Token.stringify(element, language, o);
+ return Token.stringify(element, language);
}).join('');
}
var env = {
type: o.type,
- content: Token.stringify(o.content, language, parent),
+ content: Token.stringify(o.content, language),
tag: 'span',
classes: ['token', o.type],
attributes: {},
- language: language,
- parent: parent
+ language: language
};
if (o.alias) {
- var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
+ var aliases = Array.isArray(o.alias) ? o.alias : [o.alias];
Array.prototype.push.apply(env.classes, aliases);
}
}).join(' ');
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
-
};
if (!_self.document) {
if (!_self.addEventListener) {
// in Node.js
- return _self.Prism;
+ return _;
}
if (!_.disableWorkerMessageHandler) {
}, false);
}
- return _self.Prism;
+ return _;
}
//Get current script and highlight
}
}
-return _self.Prism;
+return _;
-})();
+})(_self);
if (typeof module !== 'undefined' && module.exports) {
module.exports = Prism;
if (typeof global !== 'undefined') {
global.Prism = Prism;
}
-;