2018-08-02 22:47:49 +01:00
/ * P r i s m J S 1 . 1 5 . 0
2018-08-08 09:42:42 +01:00
https : //prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+c+csharp+bash+markup-templating+git+ini+java+json+markdown+makefile+nginx+perl+php+sql+python+yaml */
2018-08-04 09:30:26 +01:00
var _self = ( typeof window !== 'undefined' )
? window // if in browser
: (
( typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope )
? self // if in worker
: { } // if in node js
) ;
/ * *
* Prism : Lightweight , robust , elegant syntax highlighting
* MIT license http : //www.opensource.org/licenses/mit-license.php/
* @ author Lea Verou http : //lea.verou.me
* /
var Prism = ( function ( ) {
// Private helper vars
var lang = /\blang(?:uage)?-([\w-]+)\b/i ;
var uniqueId = 0 ;
var _ = _self . Prism = {
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' ) {
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 ] ;
} ,
objId : function ( obj ) {
if ( ! obj [ '__id' ] ) {
Object . defineProperty ( obj , '__id' , { value : ++ uniqueId } ) ;
}
return obj [ '__id' ] ;
} ,
// Deep clone a language definition (e.g. to extend it)
clone : function ( o , visited ) {
var type = _ . util . type ( o ) ;
visited = visited || { } ;
switch ( type ) {
case 'Object' :
if ( visited [ _ . util . objId ( o ) ] ) {
return visited [ _ . util . objId ( o ) ] ;
}
var clone = { } ;
visited [ _ . util . objId ( o ) ] = clone ;
for ( var key in o ) {
if ( o . hasOwnProperty ( key ) ) {
clone [ key ] = _ . util . clone ( o [ key ] , visited ) ;
}
}
return clone ;
case 'Array' :
if ( visited [ _ . util . objId ( o ) ] ) {
return visited [ _ . util . objId ( o ) ] ;
}
var clone = [ ] ;
visited [ _ . util . objId ( o ) ] = clone ;
o . forEach ( function ( v , i ) {
clone [ i ] = _ . util . clone ( v , visited ) ;
} ) ;
return clone ;
}
return o ;
}
} ,
languages : {
extend : function ( id , redef ) {
var lang = _ . util . clone ( _ . languages [ id ] ) ;
for ( var key in redef ) {
lang [ key ] = redef [ key ] ;
}
return lang ;
} ,
/ * *
* 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 .
* @ 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 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 ] ;
}
}
// Update references in other language definitions
_ . languages . DFS ( _ . languages , function ( key , value ) {
if ( value === root [ inside ] && key != inside ) {
this [ key ] = ret ;
}
} ) ;
return root [ inside ] = ret ;
} ,
// Traverse a language definition with Depth First Search
DFS : function ( o , callback , type , visited ) {
visited = visited || { } ;
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 ) ;
}
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 ) ;
}
}
}
}
} ,
plugins : { } ,
highlightAll : function ( async , callback ) {
_ . highlightAllUnder ( document , async , callback ) ;
} ,
highlightAllUnder : function ( container , async , callback ) {
var env = {
callback : callback ,
selector : 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
} ;
_ . hooks . run ( "before-highlightall" , env ) ;
var elements = env . elements || container . querySelectorAll ( env . selector ) ;
for ( var i = 0 , element ; element = elements [ i ++ ] ; ) {
_ . highlightElement ( element , async === true , env . callback ) ;
}
} ,
highlightElement : function ( element , async , callback ) {
// Find language
var language , grammar , parent = element ;
while ( parent && ! lang . test ( parent . className ) ) {
parent = parent . parentNode ;
}
if ( parent ) {
language = ( parent . className . match ( lang ) || [ , '' ] ) [ 1 ] . toLowerCase ( ) ;
grammar = _ . languages [ language ] ;
}
// Set language on the element, if not present
element . className = element . className . replace ( lang , '' ) . replace ( /\s+/g , ' ' ) + ' language-' + language ;
if ( element . parentNode ) {
// Set language on the parent, for styling
parent = element . parentNode ;
if ( /pre/i . test ( parent . nodeName ) ) {
parent . className = parent . className . replace ( lang , '' ) . replace ( /\s+/g , ' ' ) + ' language-' + language ;
}
}
var code = element . textContent ;
var env = {
element : element ,
language : language ,
grammar : grammar ,
code : code
} ;
_ . 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 ) ;
}
_ . hooks . run ( 'complete' , env ) ;
return ;
}
_ . hooks . run ( 'before-highlight' , env ) ;
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 ) ;
} ;
worker . postMessage ( JSON . stringify ( {
language : env . language ,
code : env . code ,
immediateClose : true
} ) ) ;
}
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 ) ;
}
} ,
highlight : function ( text , grammar , language ) {
var env = {
code : text ,
grammar : grammar ,
language : language
} ;
_ . hooks . run ( 'before-tokenize' , env ) ;
env . tokens = _ . tokenize ( env . code , env . grammar ) ;
_ . hooks . run ( 'after-tokenize' , env ) ;
return Token . stringify ( _ . util . encode ( env . tokens ) , 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 ;
}
if ( token == target ) {
return ;
}
var patterns = grammar [ token ] ;
patterns = ( _ . util . type ( patterns ) === "Array" ) ? patterns : [ patterns ] ;
for ( var j = 0 ; j < patterns . length ; ++ j ) {
var pattern = patterns [ j ] ,
inside = pattern . inside ,
lookbehind = ! ! pattern . lookbehind ,
greedy = ! ! pattern . greedy ,
lookbehindLength = 0 ,
alias = pattern . alias ;
if ( greedy && ! pattern . pattern . global ) {
// Without the global flag, lastIndex won't work
var flags = pattern . pattern . toString ( ) . match ( /[imuy]*$/ ) [ 0 ] ;
pattern . pattern = RegExp ( pattern . pattern . source , flags + "g" ) ;
}
pattern = pattern . pattern || pattern ;
// Don’ t cache length as it changes during the loop
for ( var i = index , pos = startPos ; i < strarr . length ; pos += strarr [ i ] . length , ++ i ) {
var str = strarr [ i ] ;
if ( strarr . length > text . length ) {
// Something went terribly wrong, ABORT, ABORT!
return ;
}
if ( str instanceof Token ) {
continue ;
}
if ( greedy && i != strarr . length - 1 ) {
pattern . lastIndex = pos ;
var match = pattern . exec ( text ) ;
if ( ! match ) {
break ;
}
var from = match . index + ( lookbehind ? match [ 1 ] . length : 0 ) ,
to = match . index + match [ 0 ] . length ,
k = i ,
p = pos ;
for ( var len = strarr . length ; k < len && ( p < to || ( ! strarr [ k ] . type && ! strarr [ k - 1 ] . greedy ) ) ; ++ k ) {
p += strarr [ k ] . length ;
// Move the index i to the element in strarr that is closest to from
if ( from >= p ) {
++ i ;
pos = p ;
}
}
// If strarr[i] is a Token, then the match starts inside another Token, which is invalid
if ( strarr [ i ] instanceof Token ) {
continue ;
}
// Number of tokens to delete and replace with the new match
delNum = k - i ;
str = text . slice ( pos , p ) ;
match . index -= pos ;
} else {
pattern . lastIndex = 0 ;
var match = pattern . exec ( str ) ,
delNum = 1 ;
}
if ( ! match ) {
if ( oneshot ) {
break ;
}
continue ;
}
if ( lookbehind ) {
lookbehindLength = match [ 1 ] ? match [ 1 ] . length : 0 ;
}
var from = match . index + lookbehindLength ,
match = match [ 0 ] . slice ( lookbehindLength ) ,
to = from + match . length ,
before = str . slice ( 0 , from ) ,
after = str . slice ( to ) ;
var args = [ i , delNum ] ;
if ( before ) {
++ i ;
pos += before . length ;
args . push ( before ) ;
}
var wrapped = new Token ( token , inside ? _ . tokenize ( match , inside ) : match , alias , match , greedy ) ;
args . push ( wrapped ) ;
if ( after ) {
args . push ( after ) ;
}
Array . prototype . splice . apply ( strarr , args ) ;
if ( delNum != 1 )
_ . matchGrammar ( text , strarr , grammar , i , pos , true , token ) ;
if ( oneshot )
break ;
}
}
}
} ,
tokenize : function ( text , grammar , language ) {
var strarr = [ text ] ;
var rest = grammar . rest ;
if ( rest ) {
for ( var token in rest ) {
grammar [ token ] = rest [ token ] ;
}
delete grammar . rest ;
}
_ . matchGrammar ( text , strarr , grammar , 0 , 0 , false ) ;
return strarr ;
} ,
hooks : {
all : { } ,
add : function ( name , callback ) {
var hooks = _ . hooks . all ;
hooks [ name ] = hooks [ name ] || [ ] ;
hooks [ name ] . push ( callback ) ;
} ,
run : function ( name , env ) {
var callbacks = _ . hooks . all [ name ] ;
if ( ! callbacks || ! callbacks . length ) {
return ;
}
for ( var i = 0 , callback ; callback = callbacks [ i ++ ] ; ) {
callback ( env ) ;
}
}
}
} ;
var Token = _ . Token = function ( 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 ) {
if ( typeof o == 'string' ) {
return o ;
}
if ( _ . util . type ( o ) === 'Array' ) {
return o . map ( function ( element ) {
return Token . stringify ( element , language , o ) ;
} ) . join ( '' ) ;
}
var env = {
type : o . type ,
content : Token . stringify ( o . content , language , parent ) ,
tag : 'span' ,
classes : [ 'token' , o . type ] ,
attributes : { } ,
language : language ,
parent : parent
} ;
if ( o . alias ) {
var aliases = _ . util . type ( o . alias ) === 'Array' ? o . alias : [ o . alias ] ;
Array . prototype . push . apply ( env . classes , aliases ) ;
}
_ . hooks . run ( 'wrap' , env ) ;
var attributes = Object . keys ( env . attributes ) . map ( function ( name ) {
return name + '="' + ( env . attributes [ name ] || '' ) . replace ( /"/g , '"' ) + '"' ;
} ) . 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 ;
}
if ( ! _ . disableWorkerMessageHandler ) {
// In worker
_self . addEventListener ( 'message' , function ( evt ) {
var message = JSON . parse ( evt . data ) ,
lang = message . language ,
code = message . code ,
immediateClose = message . immediateClose ;
_self . postMessage ( _ . highlight ( code , _ . languages [ lang ] , lang ) ) ;
if ( immediateClose ) {
_self . close ( ) ;
}
} , false ) ;
}
return _self . Prism ;
}
//Get current script and highlight
var script = document . currentScript || [ ] . slice . call ( document . getElementsByTagName ( "script" ) ) . pop ( ) ;
if ( script ) {
_ . filename = script . src ;
if ( ! _ . manual && ! script . hasAttribute ( 'data-manual' ) ) {
if ( document . readyState !== "loading" ) {
if ( window . requestAnimationFrame ) {
window . requestAnimationFrame ( _ . highlightAll ) ;
} else {
window . setTimeout ( _ . highlightAll , 16 ) ;
}
}
else {
document . addEventListener ( 'DOMContentLoaded' , _ . highlightAll ) ;
}
}
}
return _self . Prism ;
} ) ( ) ;
if ( typeof module !== 'undefined' && module . exports ) {
module . exports = Prism ;
}
// hack for components to work correctly in node.js
if ( typeof global !== 'undefined' ) {
global . Prism = Prism ;
}
;
Prism . languages . markup = {
'comment' : /<!--[\s\S]*?-->/ ,
'prolog' : /<\?[\s\S]+?\?>/ ,
'doctype' : /<!DOCTYPE[\s\S]+?>/i ,
'cdata' : /<!\[CDATA\[[\s\S]*?]]>/i ,
'tag' : {
pattern : /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i ,
greedy : true ,
inside : {
'tag' : {
pattern : /^<\/?[^\s>\/]+/i ,
inside : {
'punctuation' : /^<\/?/ ,
'namespace' : /^[^\s>\/:]+:/
}
} ,
'attr-value' : {
pattern : /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i ,
inside : {
'punctuation' : [
/^=/ ,
{
pattern : /(^|[^\\])["']/ ,
lookbehind : true
}
]
}
} ,
'punctuation' : /\/?>/ ,
'attr-name' : {
pattern : /[^\s>\/]+/ ,
inside : {
'namespace' : /^[^\s>\/:]+:/
}
}
}
} ,
'entity' : /&#?[\da-z]{1,8};/i
} ;
Prism . languages . markup [ 'tag' ] . inside [ 'attr-value' ] . inside [ 'entity' ] =
Prism . languages . markup [ 'entity' ] ;
// Plugin to make entity title show the real entity, idea by Roman Komarov
Prism . hooks . add ( 'wrap' , function ( env ) {
if ( env . type === 'entity' ) {
env . attributes [ 'title' ] = env . content . replace ( /&/ , '&' ) ;
}
} ) ;
Prism . languages . xml = Prism . languages . markup ;
Prism . languages . html = Prism . languages . markup ;
Prism . languages . mathml = Prism . languages . markup ;
Prism . languages . svg = Prism . languages . markup ;
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' : /[(){};:]/
} ;
Prism . languages . css [ 'atrule' ] . inside . rest = Prism . languages . css ;
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' ,
greedy : true
}
} ) ;
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
} ,
'punctuation' : /^\s*=\s*['"]|['"]\s*$/ ,
'attr-value' : {
pattern : /.+/i ,
inside : Prism . languages . css
}
} ,
alias : 'language-css'
}
} , Prism . languages . markup . tag ) ;
} ;
Prism . languages . clike = {
'comment' : [
{
pattern : /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/ ,
lookbehind : true
} ,
{
pattern : /(^|[^\\:])\/\/.*/ ,
lookbehind : true ,
greedy : true
}
] ,
'string' : {
pattern : /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/ ,
greedy : true
} ,
'class-name' : {
pattern : /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i ,
lookbehind : true ,
inside : {
punctuation : /[.\\]/
}
} ,
'keyword' : /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/ ,
'boolean' : /\b(?:true|false)\b/ ,
'function' : /[a-z0-9_]+(?=\()/i ,
'number' : /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i ,
'operator' : /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/ ,
'punctuation' : /[{}[\];(),.:]/
} ;
Prism . languages . javascript = Prism . languages . extend ( 'clike' , {
'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)\b/ ,
'number' : /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/ ,
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
'function' : /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i ,
'operator' : /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
} ) ;
Prism . languages . insertBefore ( 'javascript' , 'keyword' , {
'regex' : {
pattern : /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\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 ,
alias : 'function'
} ,
'constant' : /\b[A-Z][A-Z\d_]*\b/
} ) ;
Prism . languages . insertBefore ( 'javascript' , 'string' , {
'template-string' : {
pattern : /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/ ,
greedy : true ,
inside : {
'interpolation' : {
pattern : /\${[^}]+}/ ,
inside : {
'interpolation-punctuation' : {
pattern : /^\${|}$/ ,
alias : 'punctuation'
} ,
rest : null // See below
}
} ,
'string' : /[\s\S]+/
}
}
} ) ;
Prism . languages . javascript [ 'template-string' ] . inside [ 'interpolation' ] . inside . rest = Prism . languages . javascript ;
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 . js = Prism . languages . javascript ;
Prism . languages . c = Prism . languages . extend ( 'clike' , {
'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' : /-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/ ,
'number' : /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
} ) ;
Prism . languages . insertBefore ( 'c' , 'string' , {
'macro' : {
// allow for multiline macro definitions
// spaces after the # character compile fine with gcc
pattern : /(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im ,
lookbehind : true ,
alias : 'property' ,
inside : {
// highlight the path of the include statement as a string
'string' : {
pattern : /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/ ,
lookbehind : true
} ,
// highlight macro directives as keywords
'directive' : {
pattern : /(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/ ,
lookbehind : true ,
alias : 'keyword'
}
}
} ,
// highlight predefined macros as constants
'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' ] ;
Prism . languages . csharp = Prism . languages . extend ( 'clike' , {
'keyword' : /\b(?:abstract|add|alias|as|ascending|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|global|goto|group|if|implicit|in|int|interface|internal|into|is|join|let|lock|long|namespace|new|null|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/ ,
'string' : [
{
pattern : /@("|')(?:\1\1|\\[\s\S]|(?!\1)[^\\])*\1/ ,
greedy : true
} ,
{
pattern : /("|')(?:\\.|(?!\1)[^\\\r\n])*?\1/ ,
greedy : true
}
] ,
'class-name' : [
{
// (Foo bar, Bar baz)
pattern : /\b[A-Z]\w*(?:\.\w+)*\b(?=\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)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/ ,
lookbehind : true ,
inside : {
punctuation : /\./
}
}
] ,
'number' : /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i
} ) ;
Prism . languages . insertBefore ( 'csharp' , 'class-name' , {
'generic-method' : {
pattern : /\w+\s*<[^>\r\n]+?>\s*(?=\()/ ,
inside : {
function : /^\w+/ ,
'class-name' : {
pattern : /\b[A-Z]\w*(?:\.\w+)*\b/ ,
inside : {
punctuation : /\./
}
} ,
keyword : Prism . languages . csharp . keyword ,
punctuation : /[<>(),.:]/
}
} ,
'preprocessor' : {
pattern : /(^\s*)#.*/m ,
lookbehind : true ,
alias : 'property' ,
inside : {
// highlight preprocessor directives as keywords
'directive' : {
pattern : /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/ ,
lookbehind : true ,
alias : 'keyword'
}
}
}
} ) ;
Prism . languages . dotnet = Prism . languages . csharp ;
( function ( Prism ) {
var insideString = {
variable : [
// Arithmetic Environment
{
pattern : /\$?\(\([\s\S]+?\)\)/ ,
inside : {
// If there is a $ sign at the beginning highlight $(( and )) as variable
variable : [ {
pattern : /(^\$\(\([\s\S]+)\)\)/ ,
lookbehind : true
} ,
/^\$\(\(/
] ,
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 : /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/ ,
// If there is no $ sign at the beginning highlight (( and )) as punctuation
punctuation : /\(\(?|\)\)?|,|;/
}
} ,
// Command Substitution
{
pattern : /\$\([^)]+\)|`[^`]+`/ ,
greedy : true ,
inside : {
variable : /^\$\(|^`|\)$|`$/
}
} ,
/\$(?:[\w#?*!@]+|\{[^}]+\})/i
]
} ;
Prism . languages . bash = {
'shebang' : {
pattern : /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/ ,
alias : 'important'
} ,
'comment' : {
pattern : /(^|[^"{\\])#.*/ ,
lookbehind : true
} ,
'string' : [
//Support for Here-Documents https://en.wikipedia.org/wiki/Here_document
{
pattern : /((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/ ,
lookbehind : true ,
greedy : true ,
inside : insideString
} ,
{
pattern : /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/ ,
greedy : true ,
inside : insideString
}
] ,
'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;|&])/ ,
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;|&])/ ,
lookbehind : true
} ,
'boolean' : {
pattern : /(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/ ,
lookbehind : true
} ,
'operator' : /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/ ,
'punctuation' : /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
} ;
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 ;
Prism . languages . shell = Prism . languages . bash ;
} ) ( Prism ) ;
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 ;
}
env . tokenStack = [ ] ;
env . code = env . code . replace ( placeholderPattern , function ( match ) {
if ( typeof replaceFilter === 'function' && ! replaceFilter ( match ) ) {
return match ;
}
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 ;
return '___' + language . toUpperCase ( ) + i + '___' ;
} ) ;
// 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 ;
}
// Switch the grammar back
env . grammar = Prism . languages [ language ] ;
var j = 0 ;
var keys = Object . keys ( env . tokenStack ) ;
var walkTokens = function ( tokens ) {
if ( j >= keys . length ) {
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 ;
}
}
} else if ( token . content && typeof token . content !== 'string' ) {
walkTokens ( token . content ) ;
}
}
} ;
walkTokens ( env . tokens ) ;
}
}
} ) ;
Prism . languages . git = {
/ *
* A simple one line comment like in a git status command
* For instance :
* $ git status
* # On branch infinite - scroll
* # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged ,
* # and have 1 and 2 different commits each , respectively .
* nothing to commit ( working directory clean )
* /
'comment' : /^#.*/m ,
/ *
* Regexp to match the changed lines in a git diff output . Check the example below .
* /
'deleted' : /^[-– ].*/m ,
'inserted' : /^\+.*/m ,
/ *
* a string ( double and simple quote )
* /
'string' : /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m ,
/ *
* a git command . It starts with a random prompt finishing by a $ , then "git" then some other parameters
* For instance :
* $ git add file . txt
* /
'command' : {
pattern : /^.*\$ git .*$/m ,
inside : {
/ *
* A git command can contain a parameter starting by a single or a double dash followed by a string
* For instance :
* $ git diff -- cached
* $ git log - p
* /
'parameter' : /\s--?\w+/m
}
} ,
/ *
* Coordinates displayed in a git diff command
* For instance :
* $ git diff
* diff -- git file . txt file . txt
* index 6214953. . 1 d54a52 100644
* -- - file . txt
* ++ + file . txt
* @ @ - 1 + 1 , 2 @ @
* - Here ' s my tetx file
* + Here ' s my text file
* + And this is the second line
* /
'coord' : /^@@.*@@$/m ,
/ *
* Match a "commit [SHA1]" line in a git log output .
* For instance :
* $ git log
* commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
* Author : lgiraudel
* Date : Mon Feb 17 11 : 18 : 34 2014 + 0100
*
* Add of a new line
* /
'commit_sha1' : /^commit \w{40}$/m
} ;
Prism . languages . ini = {
'comment' : /^[ \t]*;.*$/m ,
'selector' : /^[ \t]*\[.*?\]/m ,
'constant' : /^[ \t]*[^\s=]+?(?=[ \t]*=)/m ,
'attr-value' : {
pattern : /=.*/ ,
inside : {
'punctuation' : /^[=]/
}
}
} ;
Prism . languages . java = Prism . languages . extend ( 'clike' , {
'keyword' : /\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)\b/ ,
'number' : /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp-]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?[df]?/i ,
'operator' : {
pattern : /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m ,
lookbehind : true
}
} ) ;
Prism . languages . insertBefore ( 'java' , 'function' , {
'annotation' : {
alias : 'punctuation' ,
pattern : /(^|[^.])@\w+/ ,
lookbehind : true
}
} ) ;
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 : /[<>(),.:]/
}
}
} ) ;
Prism . languages . json = {
'property' : /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i ,
'string' : {
pattern : /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/ ,
greedy : true
} ,
'number' : /-?\d+\.?\d*([Ee][+-]?\d+)?/ ,
'punctuation' : /[{}[\],]/ ,
'operator' : /:/g ,
'boolean' : /\b(?:true|false)\b/i ,
'null' : /\bnull\b/i
} ;
Prism . languages . jsonp = Prism . languages . json ;
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'
}
] ,
'title' : [
{
// title 1
// =======
// title 2
// -------
pattern : /\w+.*(?:\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 only one line break
pattern : /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/ ,
lookbehind : true ,
inside : {
'punctuation' : /^\*\*|^__|\*\*$|__$/
}
} ,
'italic' : {
// *em*
// _em_
// 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 : /"(?:\\.|[^"\\])*"(?=\)$)/
}
}
}
} ) ;
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' ] ;
Prism . languages . makefile = {
'comment' : {
pattern : /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/ ,
lookbehind : true
} ,
'string' : {
pattern : /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/ ,
greedy : true
} ,
// Built-in target names
'builtin' : /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/ ,
// Targets
'symbol' : {
pattern : /^[^:=\r\n]+(?=\s*:(?!=))/m ,
inside : {
'variable' : /\$+(?:[^(){}:#=\s]+|(?=[({]))/
}
} ,
'variable' : /\$+(?:[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/ ,
'keyword' : [
// Directives
/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/ ,
// Functions
{
pattern : /(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/ ,
lookbehind : true
}
] ,
'operator' : /(?:::|[?:+!])?=|[|@]/ ,
'punctuation' : /[:;(){}]/
} ;
Prism . languages . nginx = Prism . languages . extend ( 'clike' , {
'comment' : {
pattern : /(^|[^"{\\])#.*/ ,
lookbehind : true
} ,
'keyword' : / \ b ( ? : C O N T E N T _ | D O C U M E N T _ | G A T E W A Y _ | H T T P _ | H T T P S | i f _ n o t _ e m p t y | P A T H _ | Q U E R Y _ | R E D I R E C T _ | R E M O T E _ | R E Q U E S T _ | S C G I | S C R I P T _ | S E R V E R _ | h t t p | e v e n t s | a c c e p t _ m u t e x | a c c e p t _ m u t e x _ d e l a y | a c c e s s _ l o g | a d d _ a f t e r _ b o d y | a d d _ b e f o r e _ b o d y | a d d _ h e a d e r | a d d i t i o n _ t y p e s | a i o | a l i a s | a l l o w | a n c i e n t _ b r o w s e r | a n c i e n t _ b r o w s e r _ v a l u e | a u t h | a u t h _ b a s i c | a u t h _ b a s i c _ u s e r _ f i l e | a u t h _ h t t p | a u t h _ h t t p _ h e a d e r | a u t h _ h t t p _ t i m e o u t | a u t o i n d e x | a u t o i n d e x _ e x a c t _ s i z e | a u t o i n d e x _ l o c a l t i m e | b r e a k | c h a r s e t | c h a r s e t _ m a p | c h a r s e t _ t y p e s | c h u n k e d _ t r a n s f e r _ e n c o d i n g | c l i e n t _ b o d y _ b u f f e r _ s i z e | c l i e n t _ b o d y _ i n _ f i l e _ o n l y | c l i e n t _ b o d y _ i n _ s i n g l e _ b u f f e r | c l i e n t _ b o d y _ t e m p _ p a t h | c l i e n t _ b o d y _ t i m e o u t | c l i e n t _ h e a d e r _ b u f f e r _ s i z e | c l i e n t _ h e a d e r _ t i m e o u t | c l i e n t _ m a x _ b o d y _ s i z e | c o n n e c t i o n _ p o o l _ s i z e | c r e a t e _ f u l l _ p u t _ p a t h | d a e m o n | d a v _ a c c e s s | d a v _ m e t h o d s | d e b u g _ c o n n e c t i o n | d e b u g _ p o i n t s | d e f a u l t _ t y p e | d e n y | d e v p o l l _ c h a n g e s | d e v p o l l _ e v e n t s | d i r e c t i o | d i r e c t i o _ a l i g n m e n t | d i s a b l e _ s y m l i n k s | e m p t y _ g i f | e n v | e p o l l _ e v e n t s | e r r o r _ l o g | e r r o r _ p a g e | e x p i r e s | f a s t c g i _ b u f f e r _ s i z e | f a s t c g i _ b u f f e r s | f a s t c g i _ b u s y _ b u f f e r s _ s i z e | f a s t c g i _ c a c h e | f a s t c g i _ c a c h e _ b y p a s s | f a s t c g i _ c a c h e _ k e y | f a s t c g i _ c a c h e _ l o c k | f a s t c g i _ c a c h e _ l o c k _ t i m e o u t | f a s t c g i _ c a c h e _ m e t h o d s | f a s t c g i _ c a c h e _ m i n _ u s e s | f a s t c g i _ c a c h e _ p a t h | f a s t c g i _ c a c h e _ p u r g e | f a s t c g i _ c a c h e _ u s e _ s t a l e | f a s t c g i _ c a c h e _ v a l i d | f a s t c g i _ c o n n e c t _ t i m e o u t | f a s t c g i _ h i d e _ h e a d e r | f a s t c g i _ i g n o r e _ c l i e n t _ a b o r t | f a s t c g i _ i g n o r e _ h e a d e r s | f a s t c g i _ i n d e x | f a s t c g i _ i n t e r c e p t _ e r r o r s | f a s t c g i _ k e e p _ c o n n | f a s t c g i _ m a x _ t e m p _ f i l e _ s i z e | f a s t c g i _ n e x t _ u p s t r e a m | f a s t c g i _ n o _ c a c h e | f a s t c g i _ p a r a m | f a s t c g i _ p a s s | f a s t c g i _ p a s s _ h e a d e r | f a s t c g i _ r e a d _ t i m e o u t | f a s t c g i _ r e d i r e c t _ e r r o r s | f a s t c g i _ s e n d _ t i m e o u t | f a s t c g i _ s p l i t _ p a t h _ i n f o | f a s t c g i _ s t o r e | f a s t c g i _ s t o r e _ a c c e s s | f a s t c g i _ t e m p _ f i l e _ w r i t e _ s i z e | f a s t c g i _ t e m p _ p a t h | f l v | g e o | g e o i p _ c i t y | g e o i p _ c o u n t r y | g o o g l e _ p e r f t o o l s _ p r o f i l e s | g z i p | g z i p _ b u f f e r s | g z i p _ c o m p _ l e v e l | g z i p _ d i s a b l e | g z i p _ h t t p _ v e r s i o n | g z i p _ m i n _ l e n g t h | g z i p _ p r o x i e d | g z i p _ s t a t i c | g z i p _ t y p e s | g z i p _ v a r y | i f | i f _ m o d i f i e d _ s i n c e | i g n o r e _ i n v a l i d _ h e a d e r s | i m a g e _ f i l t e r | i m a g e _ f i l t e r _ b u f f e r | i m a g e _ f i l t e r _ j p e g _ q u a l i t y | i m a g e _ f i l t e r _ s h a r p e n | i m a g e _ f i l t e r _ t r a n s p a r e n c y | i m a p _ c a p a b i l i t i e s | i m a p _ c l i e n t _ b u f f e r | i n c l u d e | i n d e x | i n t e r n a l | i p _ h a s h | k e e p a l i v e | k e e p a l i v e _ d i s a b l e | k e e p a l i v e _ r e q u e s t s | k e e p a l i v e _ t i m e o u t | k q u e u e _ c h a n g e s | k q u e u e _ e v e n t s | l a r g e _ c l i e n t _ h e a d e r _ b u f f e r s | l i m i t _ c o n n | l i m i t _ c o n n _ l o g _ l e v e l | l i m i t _ c o n n _ z o n e | l i m i t _ e x c e p t | l i m i t _ r a t e | l i m i t _ r a t e _ a f t e r | l i m i t _ r e q | l i m i t _ r e q _ l o g _ l e v e l | l i m i t _ r e q _ z o n e | l i m i t _ z o n e | l i n g e r i n g _ c l o s e | l i n g e r i n g _ t i m e | l i n g e r i n g _ t i m e o u t | l i s t e n | l o c a t i o n | l o c k _ f i l e | l o g _ f o r m a t | l o g _ f o r m a t _ c o m b i n e d | l o g _ n o t _ f o u n d | l o g _ s u b r e q u e s t | m a p | m a p _ h a s h _ b u c k e t _ s i z e | m a p _ h a s h _ m a x _ s i z e | m a s t e r _ p r o c e s s | m a x _ r a n g e s | m e m c a c h e d _ b u f f e r _ s i z e | m e m c a c h e d _ c o n n e c t _ t i m e o u t | m e m c a c h e d _ n e x t _ u p s t r e a m | m e m c a c h e d _ p a s s | m e m c a c h e d _ r e a d _ t i m e o u t | m e m c a c h e d _ s e n d _ t i m e o u t | m e r g e _ s l a s h e s | m i n _ d e l e t e _ d e p t h | m o d e r n _ b r o w s e r | m o d e r n _ b r o w s e r _ v a l u e | m p 4 | m p 4 _ b u f f e r _ s i z e | m p 4 _ m a x _ b u f f e r _ s i z e | m s i e _ p a d d i n g | m s i e _ r e f r e s h | m u l t i _ a c c e p t | o p e n _ f i l e _ c a c h e | o p e n _ f i l e _ c a c h e _ e r r o r s | o p e n _ f i l e _ c a c h e _ m i n _ u s e s | o p e n _ f i l e _ c a c h e _ v a l i d | o p e n _ l o g _ f i l e _ c a c h e | o p t i m i z e _ s e r v e r _ n a m e s | o v e r r i d e _ c h a r s e t | p c r e _ j i t | p e r l | p e r l _ m o d u l e s | p e r l _ r e q u i r e | p e r l _ s e t | p i d | p o p 3 _ a u t h | p o p 3 _ c a p a b i l i t i e s | p o r t _ i n _ r e d i r e c t | p o s t _ a c t i o n | p o s t p o n e _ o u t p u t | p r o t o c o l | p r o x y | p r o x y _ b u f f e r | p r o x y _ b u f f e r _ s i z e | p r o x y _ b u f f e r i n g | p r o x y _ b u f f e r s | p r o x y _ b u s y _ b u f f e r s _ s i z e | p r o x y _ c a c h e | p r o x y _ c a c h e _ b y p a s s | p r o x y _ c a c h e _ k e y | p r o x y _ c a c h e _ l o c k | p r o x y _ c a c h e _ l o c k _ t i m e o u t | p r o x y _ c a c h e _ m e t h o d s | p r o x y _ c a c h e _ m i n _ u s e s | p r o x y _ c a c h e _ p a t h | p r o x y _ c a c h e _ u s e _ s t a l e | p r o x y _ c a c h e _ v a l i d | p r o x y _ c o n n e c t _ t i m e o u t | p r o x y _ c o o k i e _ d o m a i n | p r o x y _ c o o k i e _ p a t h | p r o x y _ h e a d e r s _ h a s h _ b u c k e t _ s i z e | p r o x y _ h e a d e r s _ h a s h _ m a x _ s i z e | p r o x y _ h i d e _ h e a d e r | p r o x y _ h t t p _ v e r s i o n | p r o x y _ i g n o r e _ c l i e n t _ a b o r t | p r o x y _ i g n o r e _ h e a d e r s | p r o x y _ i n t e r c e p t _ e r r o r s | p r o x y _ m a x _ t e m p _ f i l e _ s i z e | p r o x y _ m e t h o d | p r o x y _ n e x t _ u p s t r e a m | p r o x y _ n o _ c a c h e | p r o x y _ p a s s | p r o x y _ p a s s _ e r r o r _ m e s s a g e | p r o x y _ p a s s _ h e a d e r | p r o x y _ p a s s _ r e q u e s t _ b o d y | p r o x y _ p a s s _ r e q u e s t _ h e a d e r s | p r o x y _ r e a d _ t i m e o u t | p r o x y _ r e d i r e c t | p r o x y _ r e d i r e c t _ e r r o r s | p r o x y _ s e n d _ l o w a t | p r o x y _ s e n d _ t i m e o u t | p r o x y _ s e t _ b o d y | p r o x y _ s e t _ h e a d e r | p r o x y _ s s l _ s e s s i o n _ r e u s e | p r o x y _ s t o r e | p r o x y _ s t o r e _ a c c e s s | p r o x y _ t e m p _ f i l e _ w r i t e _ s i z e | p r o x y _ t e m p _ p a t h | p r o x y _ t i m e o u t | p r o x y _ u p s t r e a m _ f a i l _ t i m e o u t | p r o x y _ u p s t r e a m _ m a x _ f a i l s | r a n d o m _ i n d e x | r e a d _ a h e a d | r e
} ) ;
Prism . languages . insertBefore ( 'nginx' , 'keyword' , {
'variable' : /\$[a-z_]+/i
} ) ;
Prism . languages . perl = {
'comment' : [
{
// POD
pattern : /(^\s*)=\w+[\s\S]*?=cut.*/m ,
lookbehind : true
} ,
{
pattern : /(^|[^\\$])#.*/ ,
lookbehind : true
}
] ,
// TODO Could be nice to handle Heredoc too.
'string' : [
// q/.../
{
pattern : /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/ ,
greedy : true
} ,
// q a...a
{
pattern : /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1/ ,
greedy : true
} ,
// q(...)
{
pattern : /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/ ,
greedy : true
} ,
// q{...}
{
pattern : /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/ ,
greedy : true
} ,
// q[...]
{
pattern : /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/ ,
greedy : true
} ,
// q<...>
{
pattern : /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/ ,
greedy : true
} ,
// "...", `...`
{
pattern : /("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/ ,
greedy : true
} ,
// '...'
// FIXME Multi-line single-quoted strings are not supported as they would break variables containing '
{
pattern : /'(?:[^'\\\r\n]|\\.)*'/ ,
greedy : true
}
] ,
'regex' : [
// m/.../
{
pattern : /\b(?:m|qr)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/ ,
greedy : true
} ,
// m a...a
{
pattern : /\b(?:m|qr)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/ ,
greedy : true
} ,
// m(...)
{
pattern : /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/ ,
greedy : true
} ,
// m{...}
{
pattern : /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/ ,
greedy : true
} ,
// m[...]
{
pattern : /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/ ,
greedy : true
} ,
// m<...>
{
pattern : /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/ ,
greedy : true
} ,
// The lookbehinds prevent -s from breaking
// FIXME We don't handle change of separator like s(...)[...]
// s/.../.../
{
pattern : /(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/ ,
lookbehind : true ,
greedy : true
} ,
// s a...a...a
{
pattern : /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/ ,
lookbehind : true ,
greedy : true
} ,
// s(...)(...)
{
pattern : /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/ ,
lookbehind : true ,
greedy : true
} ,
// s{...}{...}
{
pattern : /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/ ,
lookbehind : true ,
greedy : true
} ,
// s[...][...]
{
pattern : /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/ ,
lookbehind : true ,
greedy : true
} ,
// s<...><...>
{
pattern : /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/ ,
lookbehind : true ,
greedy : true
} ,
// /.../
// The look-ahead tries to prevent two divisions on
// the same line from being highlighted as regex.
// This does not support multi-line regex.
{
pattern : /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/ ,
greedy : true
}
] ,
// FIXME Not sure about the handling of ::, ', and #
'variable' : [
// ${^POSTMATCH}
/[&*$@%]\{\^[A-Z]+\}/ ,
// $^V
/[&*$@%]\^[A-Z_]/ ,
// ${...}
/[&*$@%]#?(?=\{)/ ,
// $foo
/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+)+(?:::)*/i ,
// $1
/[&*$@%]\d+/ ,
// $_, @_, %!
// The negative lookahead prevents from breaking the %= operator
/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/
] ,
'filehandle' : {
// <>, <FOO>, _
pattern : /<(?![<=])\S*>|\b_\b/ ,
alias : 'symbol'
} ,
'vstring' : {
// v1.2, 1.2.3
pattern : /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/ ,
alias : 'string'
} ,
'function' : {
pattern : /sub [a-z0-9_]+/i ,
inside : {
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/ ,
'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' : /[{}[\];(),:]/
} ;
/ * *
* Original by Aaron Harun : http : //aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
* Modified by Miles Johnson : http : //milesj.me
*
* Supports the following :
* - Extends clike syntax
* - Support for PHP 5.3 + ( namespaces , traits , generators , etc )
* - Smarter constant and function matching
*
* Adds the following new token classes :
* constant , delimiter , variable , function , package
* /
( 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/ ,
'comment' : {
pattern : /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/ ,
lookbehind : true
}
} ) ;
Prism . languages . insertBefore ( 'php' , 'string' , {
'shell-comment' : {
pattern : /(^|[^\\])#.*/ ,
lookbehind : true ,
alias : 'comment'
}
} ) ;
Prism . languages . insertBefore ( 'php' , 'keyword' , {
'delimiter' : {
pattern : /\?>|<\?(?:php|=)?/i ,
alias : 'important'
} ,
'variable' : /\$+(?:\w+\b|(?={))/i ,
'package' : {
pattern : /(\\|namespace\s+|use\s+)[\w\\]+/ ,
lookbehind : true ,
inside : {
punctuation : /\\/
}
}
} ) ;
// Must be defined after the function pattern
Prism . languages . insertBefore ( 'php' , 'operator' , {
'property' : {
pattern : /(->)[\w]+/ ,
lookbehind : true
}
} ) ;
Prism . languages . insertBefore ( 'php' , 'string' , {
'nowdoc-string' : {
pattern : /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/ ,
greedy : true ,
alias : 'string' ,
inside : {
'delimiter' : {
pattern : /^<<<'[^']+'|[a-z_]\w*;$/i ,
alias : 'symbol' ,
inside : {
'punctuation' : /^<<<'?|[';]$/
}
}
}
} ,
'heredoc-string' : {
pattern : /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i ,
greedy : true ,
alias : 'string' ,
inside : {
'delimiter' : {
pattern : /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i ,
alias : 'symbol' ,
inside : {
'punctuation' : /^<<<"?|[";]$/
}
} ,
'interpolation' : null // See below
}
} ,
'single-quoted-string' : {
pattern : /'(?:\\[\s\S]|[^\\'])*'/ ,
greedy : true ,
alias : 'string'
} ,
'double-quoted-string' : {
pattern : /"(?:\\[\s\S]|[^\\"])*"/ ,
greedy : true ,
alias : 'string' ,
inside : {
'interpolation' : null // See below
}
}
} ) ;
// The different types of PHP strings "replace" the C-like standard string
delete Prism . languages . php [ 'string' ] ;
var string _interpolation = {
pattern : /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/ ,
lookbehind : true ,
inside : {
rest : Prism . languages . php
}
} ;
Prism . languages . php [ 'heredoc-string' ] . inside [ 'interpolation' ] = string _interpolation ;
Prism . languages . php [ 'double-quoted-string' ] . inside [ 'interpolation' ] = string _interpolation ;
Prism . hooks . add ( 'before-tokenize' , function ( env ) {
if ( ! /(?:<\?php|<\?)/ig . test ( env . code ) ) {
return ;
}
var phpPattern = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig ;
Prism . languages [ 'markup-templating' ] . buildPlaceholders ( env , 'php' , phpPattern ) ;
} ) ;
Prism . hooks . add ( 'after-tokenize' , function ( env ) {
Prism . languages [ 'markup-templating' ] . tokenizePlaceholders ( env , 'php' ) ;
} ) ;
} ( Prism ) ) ;
Prism . languages . sql = {
'comment' : {
pattern : /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/ ,
lookbehind : true
} ,
'string' : {
pattern : /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\])*\2/ ,
greedy : true ,
lookbehind : true
} ,
'variable' : /@[\w.$]+|@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/ ,
'function' : /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i , // Should we highlight user defined functions too?
'keyword' : /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i ,
'boolean' : /\b(?:TRUE|FALSE|NULL)\b/i ,
'number' : /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i ,
'operator' : /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i ,
'punctuation' : /[;[\]()`,.]/
} ;
Prism . languages . python = {
'comment' : {
pattern : /(^|[^\\])#.*/ ,
lookbehind : true
} ,
'triple-quoted-string' : {
pattern : /("""|''')[\s\S]+?\1/ ,
greedy : true ,
alias : 'string'
} ,
'string' : {
pattern : /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/ ,
greedy : true
} ,
'function' : {
pattern : /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g ,
lookbehind : true
} ,
'class-name' : {
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/ ,
'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/ ,
'punctuation' : /[{}[\];(),.:]/
} ;
Prism . languages . yaml = {
'scalar' : {
pattern : /([\-:]\s*(?:![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\2[^\r\n]+)*)/ ,
lookbehind : true ,
alias : 'string'
} ,
'comment' : /#.*/ ,
'key' : {
pattern : /(\s*(?:^|[:\-,[{\r\n?])[ \t]*(?:![^\s]+)?[ \t]*)[^\r\n{[\]},#\s]+?(?=\s*:\s)/ ,
lookbehind : true ,
alias : 'atrule'
} ,
'directive' : {
pattern : /(^[ \t]*)%.+/m ,
lookbehind : true ,
alias : 'important'
} ,
'datetime' : {
pattern : /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?)(?=[ \t]*(?:$|,|]|}))/m ,
lookbehind : true ,
alias : 'number'
} ,
'boolean' : {
pattern : /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:true|false)[ \t]*(?=$|,|]|})/im ,
lookbehind : true ,
alias : 'important'
} ,
'null' : {
pattern : /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:null|~)[ \t]*(?=$|,|]|})/im ,
lookbehind : true ,
alias : 'important'
} ,
'string' : {
pattern : /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)("|')(?:(?!\2)[^\\\r\n]|\\.)*\2(?=[ \t]*(?:$|,|]|}))/m ,
lookbehind : true ,
greedy : true
} ,
'number' : {
pattern : /([:\-,[{]\s*(?:![^\s]+)?[ \t]*)[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+\.?\d*|\.?\d+)(?:e[+-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im ,
lookbehind : true
} ,
'tag' : /![^\s]+/ ,
'important' : /[&*][\w]+/ ,
'punctuation' : /---|[:[\]{}\-,|>?]|\.\.\./
} ;