mirror of
https://github.com/arsenetar/PrismHighlight.git
synced 2024-11-24 04:39:01 +00:00
26 lines
784 B
JavaScript
26 lines
784 B
JavaScript
|
Prism.languages.clike = {
|
||
|
'comment': {
|
||
|
pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,
|
||
|
lookbehind: true
|
||
|
},
|
||
|
'string': /("|')(\\?.)*?\1/g,
|
||
|
'class-name': {
|
||
|
pattern: /((?:class|interface|extends|implements|trait|instanceof|new)\s+)[a-z0-9_\.\\]+/ig,
|
||
|
lookbehind: true,
|
||
|
inside: {
|
||
|
punctuation: /(\.|\\)/
|
||
|
}
|
||
|
},
|
||
|
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,
|
||
|
'boolean': /\b(true|false)\b/g,
|
||
|
'function': {
|
||
|
pattern: /[a-z0-9_]+\(/ig,
|
||
|
inside: {
|
||
|
punctuation: /\(/
|
||
|
}
|
||
|
},
|
||
|
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
|
||
|
'operator': /[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,
|
||
|
'ignore': /&(lt|gt|amp);/gi,
|
||
|
'punctuation': /[{}[\];(),.:]/g
|
||
|
};
|