Update Prism.js

This commit is contained in:
Thibaut Courouble 2017-10-07 11:05:01 -04:00
parent 6783d08982
commit 385788c79d

View file

@ -60,8 +60,7 @@ var _ = _self.Prism = {
return clone;
case 'Array':
// Check for existence for IE8
return o.map && o.map(function(v) { return _.util.clone(v); });
return o.map(function(v) { return _.util.clone(v); });
}
return o;
@ -507,7 +506,7 @@ Token.stringify = function(o, language, parent) {
// if (script) {
// _.filename = script.src;
// if (document.addEventListener && !_.manual && !script.hasAttribute('data-manual')) {
// if (!_.manual && !script.hasAttribute('data-manual')) {
// if(document.readyState !== "loading") {
// if (window.requestAnimationFrame) {
// window.requestAnimationFrame(_.highlightAll);
@ -638,7 +637,7 @@ if (Prism.languages.markup) {
Prism.languages.clike = {
'comment': [
{
pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true
},
{
@ -715,7 +714,7 @@ if (Prism.languages.markup) {
Prism.languages.js = Prism.languages.javascript;
Prism.languages.c = Prism.languages.extend('clike', {
'keyword': /\b(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/,
'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': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i
});
@ -735,14 +734,14 @@ Prism.languages.insertBefore('c', 'string', {
},
// highlight macro directives as keywords
'directive': {
pattern: /(#\s*)\b(define|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,
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|stdin|stdout|stderr)\b/
'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'];