highlight.js
Advanced tools
Comparing version 10.4.0 to 10.4.1
@@ -0,1 +1,34 @@ | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function optional(re) { | ||
return concat('(', re, ')?'); | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/* | ||
@@ -7,29 +40,23 @@ Language: C-like foundation grammar for C/C++ grammars | ||
/* In the future the intention is to split out the C/C++ grammars distinctly | ||
since they are separate languages. They will likely share a common foundation | ||
though, and this file sets the groundwork for that - so that we get the breaking | ||
change in v10 and don't have to change the requirements again later. | ||
See: https://github.com/highlightjs/highlight.js/issues/2146 | ||
*/ | ||
/** @type LanguageFn */ | ||
function cLike(hljs) { | ||
function optional(s) { | ||
return '(?:' + s + ')?'; | ||
} | ||
// added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does | ||
// not include such support nor can we be sure all the grammars depending | ||
// on it would desire this behavior | ||
var C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [{begin: /\\\n/}] | ||
const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [ | ||
{ | ||
begin: /\\\n/ | ||
} | ||
] | ||
}); | ||
var DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
var NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
var TEMPLATE_ARGUMENT_RE = '<.*?>'; | ||
var FUNCTION_TYPE_RE = '(' + | ||
const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
const NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
const TEMPLATE_ARGUMENT_RE = '<[^<>]+>'; | ||
const FUNCTION_TYPE_RE = '(' + | ||
DECLTYPE_AUTO_RE + '|' + | ||
optional(NAMESPACE_RE) +'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
optional(NAMESPACE_RE) + | ||
'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
')'; | ||
var CPP_PRIMITIVE_TYPES = { | ||
const CPP_PRIMITIVE_TYPES = { | ||
className: 'keyword', | ||
@@ -41,13 +68,15 @@ begin: '\\b[a-z\\d_]*_t\\b' | ||
// \\ \x \xFF \u2837 \u00323747 \374 | ||
var CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
var STRINGS = { | ||
const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
const STRINGS = { | ||
className: 'string', | ||
variants: [ | ||
{ | ||
begin: '(u8?|U|L)?"', end: '"', | ||
begin: '(u8?|U|L)?"', | ||
end: '"', | ||
illegal: '\\n', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
contains: [ hljs.BACKSLASH_ESCAPE ] | ||
}, | ||
{ | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", end: '\'', | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", | ||
end: '\'', | ||
illegal: '.' | ||
@@ -57,3 +86,3 @@ }, | ||
begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/, | ||
end: /\)([^()\\ ]{0,16})"/, | ||
end: /\)([^()\\ ]{0,16})"/ | ||
}) | ||
@@ -63,8 +92,14 @@ ] | ||
var NUMBERS = { | ||
const NUMBERS = { | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0b[01\']+)' }, | ||
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' }, | ||
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' } | ||
{ | ||
begin: '\\b(0b[01\']+)' | ||
}, | ||
{ | ||
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' | ||
}, | ||
{ | ||
begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' | ||
} | ||
], | ||
@@ -74,5 +109,6 @@ relevance: 0 | ||
var PREPROCESSOR = { | ||
const PREPROCESSOR = { | ||
className: 'meta', | ||
begin: /#\s*[a-z]+\b/, end: /$/, | ||
begin: /#\s*[a-z]+\b/, | ||
end: /$/, | ||
keywords: { | ||
@@ -85,9 +121,13 @@ 'meta-keyword': | ||
{ | ||
begin: /\\\n/, relevance: 0 | ||
begin: /\\\n/, | ||
relevance: 0 | ||
}, | ||
hljs.inherit(STRINGS, {className: 'meta-string'}), | ||
hljs.inherit(STRINGS, { | ||
className: 'meta-string' | ||
}), | ||
{ | ||
className: 'meta-string', | ||
begin: /<.*?>/, end: /$/, | ||
illegal: '\\n', | ||
begin: /<.*?>/, | ||
end: /$/, | ||
illegal: '\\n' | ||
}, | ||
@@ -99,3 +139,3 @@ C_LINE_COMMENT_MODE, | ||
var TITLE_MODE = { | ||
const TITLE_MODE = { | ||
className: 'title', | ||
@@ -106,5 +146,5 @@ begin: optional(NAMESPACE_RE) + hljs.IDENT_RE, | ||
var FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
var CPP_KEYWORDS = { | ||
const CPP_KEYWORDS = { | ||
keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' + | ||
@@ -134,3 +174,3 @@ 'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' + | ||
var EXPRESSION_CONTAINS = [ | ||
const EXPRESSION_CONTAINS = [ | ||
PREPROCESSOR, | ||
@@ -144,3 +184,3 @@ CPP_PRIMITIVE_TYPES, | ||
var EXPRESSION_CONTEXT = { | ||
const EXPRESSION_CONTEXT = { | ||
// This mode covers expression context where we can't expect a function | ||
@@ -150,5 +190,14 @@ // definition and shouldn't highlight anything that looks like one: | ||
variants: [ | ||
{begin: /=/, end: /;/}, | ||
{begin: /\(/, end: /\)/}, | ||
{beginKeywords: 'new throw return else', end: /;/} | ||
{ | ||
begin: /=/, | ||
end: /;/ | ||
}, | ||
{ | ||
begin: /\(/, | ||
end: /\)/ | ||
}, | ||
{ | ||
beginKeywords: 'new throw return else', | ||
end: /;/ | ||
} | ||
], | ||
@@ -158,5 +207,6 @@ keywords: CPP_KEYWORDS, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
contains: EXPRESSION_CONTAINS.concat(['self']), | ||
contains: EXPRESSION_CONTAINS.concat([ 'self' ]), | ||
relevance: 0 | ||
@@ -168,6 +218,7 @@ } | ||
var FUNCTION_DECLARATION = { | ||
const FUNCTION_DECLARATION = { | ||
className: 'function', | ||
begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE, | ||
returnBegin: true, end: /[{;=]/, | ||
returnBegin: true, | ||
end: /[{;=]/, | ||
excludeEnd: true, | ||
@@ -177,11 +228,11 @@ keywords: CPP_KEYWORDS, | ||
contains: [ | ||
{ // to prevent it from being confused as the function title | ||
begin: DECLTYPE_AUTO_RE, | ||
keywords: CPP_KEYWORDS, | ||
relevance: 0, | ||
relevance: 0 | ||
}, | ||
{ | ||
begin: FUNCTION_TITLE, returnBegin: true, | ||
contains: [TITLE_MODE], | ||
begin: FUNCTION_TITLE, | ||
returnBegin: true, | ||
contains: [ TITLE_MODE ], | ||
relevance: 0 | ||
@@ -191,3 +242,4 @@ }, | ||
className: 'params', | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -203,3 +255,4 @@ relevance: 0, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -226,3 +279,13 @@ relevance: 0, | ||
return { | ||
aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'], | ||
aliases: [ | ||
'c', | ||
'cc', | ||
'h', | ||
'c++', | ||
'h++', | ||
'hpp', | ||
'hh', | ||
'hxx', | ||
'cxx' | ||
], | ||
keywords: CPP_KEYWORDS, | ||
@@ -238,21 +301,28 @@ // the base c-like language will NEVER be auto-detected, rather the | ||
[ | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: ['self', CPP_PRIMITIVE_TYPES] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', end: /[{;:<>=]/, | ||
contains: [ | ||
{ beginKeywords: "final class struct" }, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', | ||
end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: [ | ||
'self', | ||
CPP_PRIMITIVE_TYPES | ||
] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', | ||
end: /[{;:<>=]/, | ||
contains: [ | ||
{ | ||
beginKeywords: "final class struct" | ||
}, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
exports: { | ||
@@ -259,0 +329,0 @@ preprocessor: PREPROCESSOR, |
@@ -175,3 +175,3 @@ /* | ||
{ | ||
begin: '(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]', | ||
begin: '(link:)?(http|https|ftp|file|irc|image:?):\\S+?\\[[^[]*?\\]', | ||
returnBegin: true, | ||
@@ -178,0 +178,0 @@ contains: [ |
@@ -118,3 +118,3 @@ /* | ||
className: 'function', | ||
begin: /\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/, | ||
begin: /\w+ +\w+(\.\w+)?\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/, | ||
returnBegin: true, | ||
@@ -121,0 +121,0 @@ end: /[{;=]/, |
@@ -48,3 +48,3 @@ /* | ||
className: 'number', | ||
begin: '\\b([0-9]+[0-9edED\.]*[#\!]?)', | ||
begin: '\\b\\d+(\\.\\d+)?([edED]\\d+)?[#\!]?', | ||
relevance: 0 | ||
@@ -51,0 +51,0 @@ }, |
@@ -0,1 +1,34 @@ | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function optional(re) { | ||
return concat('(', re, ')?'); | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/* | ||
@@ -7,29 +40,23 @@ Language: C-like foundation grammar for C/C++ grammars | ||
/* In the future the intention is to split out the C/C++ grammars distinctly | ||
since they are separate languages. They will likely share a common foundation | ||
though, and this file sets the groundwork for that - so that we get the breaking | ||
change in v10 and don't have to change the requirements again later. | ||
See: https://github.com/highlightjs/highlight.js/issues/2146 | ||
*/ | ||
/** @type LanguageFn */ | ||
function cLike(hljs) { | ||
function optional(s) { | ||
return '(?:' + s + ')?'; | ||
} | ||
// added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does | ||
// not include such support nor can we be sure all the grammars depending | ||
// on it would desire this behavior | ||
var C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [{begin: /\\\n/}] | ||
const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [ | ||
{ | ||
begin: /\\\n/ | ||
} | ||
] | ||
}); | ||
var DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
var NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
var TEMPLATE_ARGUMENT_RE = '<.*?>'; | ||
var FUNCTION_TYPE_RE = '(' + | ||
const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
const NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
const TEMPLATE_ARGUMENT_RE = '<[^<>]+>'; | ||
const FUNCTION_TYPE_RE = '(' + | ||
DECLTYPE_AUTO_RE + '|' + | ||
optional(NAMESPACE_RE) +'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
optional(NAMESPACE_RE) + | ||
'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
')'; | ||
var CPP_PRIMITIVE_TYPES = { | ||
const CPP_PRIMITIVE_TYPES = { | ||
className: 'keyword', | ||
@@ -41,13 +68,15 @@ begin: '\\b[a-z\\d_]*_t\\b' | ||
// \\ \x \xFF \u2837 \u00323747 \374 | ||
var CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
var STRINGS = { | ||
const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
const STRINGS = { | ||
className: 'string', | ||
variants: [ | ||
{ | ||
begin: '(u8?|U|L)?"', end: '"', | ||
begin: '(u8?|U|L)?"', | ||
end: '"', | ||
illegal: '\\n', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
contains: [ hljs.BACKSLASH_ESCAPE ] | ||
}, | ||
{ | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", end: '\'', | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", | ||
end: '\'', | ||
illegal: '.' | ||
@@ -57,3 +86,3 @@ }, | ||
begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/, | ||
end: /\)([^()\\ ]{0,16})"/, | ||
end: /\)([^()\\ ]{0,16})"/ | ||
}) | ||
@@ -63,8 +92,14 @@ ] | ||
var NUMBERS = { | ||
const NUMBERS = { | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0b[01\']+)' }, | ||
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' }, | ||
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' } | ||
{ | ||
begin: '\\b(0b[01\']+)' | ||
}, | ||
{ | ||
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' | ||
}, | ||
{ | ||
begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' | ||
} | ||
], | ||
@@ -74,5 +109,6 @@ relevance: 0 | ||
var PREPROCESSOR = { | ||
const PREPROCESSOR = { | ||
className: 'meta', | ||
begin: /#\s*[a-z]+\b/, end: /$/, | ||
begin: /#\s*[a-z]+\b/, | ||
end: /$/, | ||
keywords: { | ||
@@ -85,9 +121,13 @@ 'meta-keyword': | ||
{ | ||
begin: /\\\n/, relevance: 0 | ||
begin: /\\\n/, | ||
relevance: 0 | ||
}, | ||
hljs.inherit(STRINGS, {className: 'meta-string'}), | ||
hljs.inherit(STRINGS, { | ||
className: 'meta-string' | ||
}), | ||
{ | ||
className: 'meta-string', | ||
begin: /<.*?>/, end: /$/, | ||
illegal: '\\n', | ||
begin: /<.*?>/, | ||
end: /$/, | ||
illegal: '\\n' | ||
}, | ||
@@ -99,3 +139,3 @@ C_LINE_COMMENT_MODE, | ||
var TITLE_MODE = { | ||
const TITLE_MODE = { | ||
className: 'title', | ||
@@ -106,5 +146,5 @@ begin: optional(NAMESPACE_RE) + hljs.IDENT_RE, | ||
var FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
var CPP_KEYWORDS = { | ||
const CPP_KEYWORDS = { | ||
keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' + | ||
@@ -134,3 +174,3 @@ 'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' + | ||
var EXPRESSION_CONTAINS = [ | ||
const EXPRESSION_CONTAINS = [ | ||
PREPROCESSOR, | ||
@@ -144,3 +184,3 @@ CPP_PRIMITIVE_TYPES, | ||
var EXPRESSION_CONTEXT = { | ||
const EXPRESSION_CONTEXT = { | ||
// This mode covers expression context where we can't expect a function | ||
@@ -150,5 +190,14 @@ // definition and shouldn't highlight anything that looks like one: | ||
variants: [ | ||
{begin: /=/, end: /;/}, | ||
{begin: /\(/, end: /\)/}, | ||
{beginKeywords: 'new throw return else', end: /;/} | ||
{ | ||
begin: /=/, | ||
end: /;/ | ||
}, | ||
{ | ||
begin: /\(/, | ||
end: /\)/ | ||
}, | ||
{ | ||
beginKeywords: 'new throw return else', | ||
end: /;/ | ||
} | ||
], | ||
@@ -158,5 +207,6 @@ keywords: CPP_KEYWORDS, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
contains: EXPRESSION_CONTAINS.concat(['self']), | ||
contains: EXPRESSION_CONTAINS.concat([ 'self' ]), | ||
relevance: 0 | ||
@@ -168,6 +218,7 @@ } | ||
var FUNCTION_DECLARATION = { | ||
const FUNCTION_DECLARATION = { | ||
className: 'function', | ||
begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE, | ||
returnBegin: true, end: /[{;=]/, | ||
returnBegin: true, | ||
end: /[{;=]/, | ||
excludeEnd: true, | ||
@@ -177,11 +228,11 @@ keywords: CPP_KEYWORDS, | ||
contains: [ | ||
{ // to prevent it from being confused as the function title | ||
begin: DECLTYPE_AUTO_RE, | ||
keywords: CPP_KEYWORDS, | ||
relevance: 0, | ||
relevance: 0 | ||
}, | ||
{ | ||
begin: FUNCTION_TITLE, returnBegin: true, | ||
contains: [TITLE_MODE], | ||
begin: FUNCTION_TITLE, | ||
returnBegin: true, | ||
contains: [ TITLE_MODE ], | ||
relevance: 0 | ||
@@ -191,3 +242,4 @@ }, | ||
className: 'params', | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -203,3 +255,4 @@ relevance: 0, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -226,3 +279,13 @@ relevance: 0, | ||
return { | ||
aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'], | ||
aliases: [ | ||
'c', | ||
'cc', | ||
'h', | ||
'c++', | ||
'h++', | ||
'hpp', | ||
'hh', | ||
'hxx', | ||
'cxx' | ||
], | ||
keywords: CPP_KEYWORDS, | ||
@@ -238,21 +301,28 @@ // the base c-like language will NEVER be auto-detected, rather the | ||
[ | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: ['self', CPP_PRIMITIVE_TYPES] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', end: /[{;:<>=]/, | ||
contains: [ | ||
{ beginKeywords: "final class struct" }, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', | ||
end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: [ | ||
'self', | ||
CPP_PRIMITIVE_TYPES | ||
] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', | ||
end: /[{;:<>=]/, | ||
contains: [ | ||
{ | ||
beginKeywords: "final class struct" | ||
}, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
exports: { | ||
@@ -259,0 +329,0 @@ preprocessor: PREPROCESSOR, |
@@ -0,1 +1,34 @@ | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function optional(re) { | ||
return concat('(', re, ')?'); | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/* | ||
@@ -7,29 +40,23 @@ Language: C-like foundation grammar for C/C++ grammars | ||
/* In the future the intention is to split out the C/C++ grammars distinctly | ||
since they are separate languages. They will likely share a common foundation | ||
though, and this file sets the groundwork for that - so that we get the breaking | ||
change in v10 and don't have to change the requirements again later. | ||
See: https://github.com/highlightjs/highlight.js/issues/2146 | ||
*/ | ||
/** @type LanguageFn */ | ||
function cLike(hljs) { | ||
function optional(s) { | ||
return '(?:' + s + ')?'; | ||
} | ||
// added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does | ||
// not include such support nor can we be sure all the grammars depending | ||
// on it would desire this behavior | ||
var C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [{begin: /\\\n/}] | ||
const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [ | ||
{ | ||
begin: /\\\n/ | ||
} | ||
] | ||
}); | ||
var DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
var NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
var TEMPLATE_ARGUMENT_RE = '<.*?>'; | ||
var FUNCTION_TYPE_RE = '(' + | ||
const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
const NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
const TEMPLATE_ARGUMENT_RE = '<[^<>]+>'; | ||
const FUNCTION_TYPE_RE = '(' + | ||
DECLTYPE_AUTO_RE + '|' + | ||
optional(NAMESPACE_RE) +'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
optional(NAMESPACE_RE) + | ||
'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
')'; | ||
var CPP_PRIMITIVE_TYPES = { | ||
const CPP_PRIMITIVE_TYPES = { | ||
className: 'keyword', | ||
@@ -41,13 +68,15 @@ begin: '\\b[a-z\\d_]*_t\\b' | ||
// \\ \x \xFF \u2837 \u00323747 \374 | ||
var CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
var STRINGS = { | ||
const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
const STRINGS = { | ||
className: 'string', | ||
variants: [ | ||
{ | ||
begin: '(u8?|U|L)?"', end: '"', | ||
begin: '(u8?|U|L)?"', | ||
end: '"', | ||
illegal: '\\n', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
contains: [ hljs.BACKSLASH_ESCAPE ] | ||
}, | ||
{ | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", end: '\'', | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", | ||
end: '\'', | ||
illegal: '.' | ||
@@ -57,3 +86,3 @@ }, | ||
begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/, | ||
end: /\)([^()\\ ]{0,16})"/, | ||
end: /\)([^()\\ ]{0,16})"/ | ||
}) | ||
@@ -63,8 +92,14 @@ ] | ||
var NUMBERS = { | ||
const NUMBERS = { | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0b[01\']+)' }, | ||
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' }, | ||
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' } | ||
{ | ||
begin: '\\b(0b[01\']+)' | ||
}, | ||
{ | ||
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' | ||
}, | ||
{ | ||
begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' | ||
} | ||
], | ||
@@ -74,5 +109,6 @@ relevance: 0 | ||
var PREPROCESSOR = { | ||
const PREPROCESSOR = { | ||
className: 'meta', | ||
begin: /#\s*[a-z]+\b/, end: /$/, | ||
begin: /#\s*[a-z]+\b/, | ||
end: /$/, | ||
keywords: { | ||
@@ -85,9 +121,13 @@ 'meta-keyword': | ||
{ | ||
begin: /\\\n/, relevance: 0 | ||
begin: /\\\n/, | ||
relevance: 0 | ||
}, | ||
hljs.inherit(STRINGS, {className: 'meta-string'}), | ||
hljs.inherit(STRINGS, { | ||
className: 'meta-string' | ||
}), | ||
{ | ||
className: 'meta-string', | ||
begin: /<.*?>/, end: /$/, | ||
illegal: '\\n', | ||
begin: /<.*?>/, | ||
end: /$/, | ||
illegal: '\\n' | ||
}, | ||
@@ -99,3 +139,3 @@ C_LINE_COMMENT_MODE, | ||
var TITLE_MODE = { | ||
const TITLE_MODE = { | ||
className: 'title', | ||
@@ -106,5 +146,5 @@ begin: optional(NAMESPACE_RE) + hljs.IDENT_RE, | ||
var FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
var CPP_KEYWORDS = { | ||
const CPP_KEYWORDS = { | ||
keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' + | ||
@@ -134,3 +174,3 @@ 'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' + | ||
var EXPRESSION_CONTAINS = [ | ||
const EXPRESSION_CONTAINS = [ | ||
PREPROCESSOR, | ||
@@ -144,3 +184,3 @@ CPP_PRIMITIVE_TYPES, | ||
var EXPRESSION_CONTEXT = { | ||
const EXPRESSION_CONTEXT = { | ||
// This mode covers expression context where we can't expect a function | ||
@@ -150,5 +190,14 @@ // definition and shouldn't highlight anything that looks like one: | ||
variants: [ | ||
{begin: /=/, end: /;/}, | ||
{begin: /\(/, end: /\)/}, | ||
{beginKeywords: 'new throw return else', end: /;/} | ||
{ | ||
begin: /=/, | ||
end: /;/ | ||
}, | ||
{ | ||
begin: /\(/, | ||
end: /\)/ | ||
}, | ||
{ | ||
beginKeywords: 'new throw return else', | ||
end: /;/ | ||
} | ||
], | ||
@@ -158,5 +207,6 @@ keywords: CPP_KEYWORDS, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
contains: EXPRESSION_CONTAINS.concat(['self']), | ||
contains: EXPRESSION_CONTAINS.concat([ 'self' ]), | ||
relevance: 0 | ||
@@ -168,6 +218,7 @@ } | ||
var FUNCTION_DECLARATION = { | ||
const FUNCTION_DECLARATION = { | ||
className: 'function', | ||
begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE, | ||
returnBegin: true, end: /[{;=]/, | ||
returnBegin: true, | ||
end: /[{;=]/, | ||
excludeEnd: true, | ||
@@ -177,11 +228,11 @@ keywords: CPP_KEYWORDS, | ||
contains: [ | ||
{ // to prevent it from being confused as the function title | ||
begin: DECLTYPE_AUTO_RE, | ||
keywords: CPP_KEYWORDS, | ||
relevance: 0, | ||
relevance: 0 | ||
}, | ||
{ | ||
begin: FUNCTION_TITLE, returnBegin: true, | ||
contains: [TITLE_MODE], | ||
begin: FUNCTION_TITLE, | ||
returnBegin: true, | ||
contains: [ TITLE_MODE ], | ||
relevance: 0 | ||
@@ -191,3 +242,4 @@ }, | ||
className: 'params', | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -203,3 +255,4 @@ relevance: 0, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -226,3 +279,13 @@ relevance: 0, | ||
return { | ||
aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'], | ||
aliases: [ | ||
'c', | ||
'cc', | ||
'h', | ||
'c++', | ||
'h++', | ||
'hpp', | ||
'hh', | ||
'hxx', | ||
'cxx' | ||
], | ||
keywords: CPP_KEYWORDS, | ||
@@ -238,21 +301,28 @@ // the base c-like language will NEVER be auto-detected, rather the | ||
[ | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: ['self', CPP_PRIMITIVE_TYPES] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', end: /[{;:<>=]/, | ||
contains: [ | ||
{ beginKeywords: "final class struct" }, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', | ||
end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: [ | ||
'self', | ||
CPP_PRIMITIVE_TYPES | ||
] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', | ||
end: /[{;:<>=]/, | ||
contains: [ | ||
{ | ||
beginKeywords: "final class struct" | ||
}, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
exports: { | ||
@@ -259,0 +329,0 @@ preprocessor: PREPROCESSOR, |
@@ -278,3 +278,3 @@ const KEYWORDS = [ | ||
}); | ||
const PARAMS_RE = '(\\(.*\\))?\\s*\\B[-=]>'; | ||
const POSSIBLE_PARAMS_RE = '(\\(.*\\)\\s*)?\\B[-=]>'; | ||
const PARAMS = { | ||
@@ -308,3 +308,3 @@ className: 'params', | ||
className: 'function', | ||
begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + PARAMS_RE, | ||
begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + POSSIBLE_PARAMS_RE, | ||
end: '[-=]>', | ||
@@ -323,3 +323,3 @@ returnBegin: true, | ||
className: 'function', | ||
begin: PARAMS_RE, | ||
begin: POSSIBLE_PARAMS_RE, | ||
end: '[-=]>', | ||
@@ -326,0 +326,0 @@ returnBegin: true, |
@@ -0,1 +1,34 @@ | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function optional(re) { | ||
return concat('(', re, ')?'); | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/* | ||
@@ -7,29 +40,23 @@ Language: C-like foundation grammar for C/C++ grammars | ||
/* In the future the intention is to split out the C/C++ grammars distinctly | ||
since they are separate languages. They will likely share a common foundation | ||
though, and this file sets the groundwork for that - so that we get the breaking | ||
change in v10 and don't have to change the requirements again later. | ||
See: https://github.com/highlightjs/highlight.js/issues/2146 | ||
*/ | ||
/** @type LanguageFn */ | ||
function cLike(hljs) { | ||
function optional(s) { | ||
return '(?:' + s + ')?'; | ||
} | ||
// added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does | ||
// not include such support nor can we be sure all the grammars depending | ||
// on it would desire this behavior | ||
var C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [{begin: /\\\n/}] | ||
const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { | ||
contains: [ | ||
{ | ||
begin: /\\\n/ | ||
} | ||
] | ||
}); | ||
var DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
var NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
var TEMPLATE_ARGUMENT_RE = '<.*?>'; | ||
var FUNCTION_TYPE_RE = '(' + | ||
const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'; | ||
const NAMESPACE_RE = '[a-zA-Z_]\\w*::'; | ||
const TEMPLATE_ARGUMENT_RE = '<[^<>]+>'; | ||
const FUNCTION_TYPE_RE = '(' + | ||
DECLTYPE_AUTO_RE + '|' + | ||
optional(NAMESPACE_RE) +'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
optional(NAMESPACE_RE) + | ||
'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) + | ||
')'; | ||
var CPP_PRIMITIVE_TYPES = { | ||
const CPP_PRIMITIVE_TYPES = { | ||
className: 'keyword', | ||
@@ -41,13 +68,15 @@ begin: '\\b[a-z\\d_]*_t\\b' | ||
// \\ \x \xFF \u2837 \u00323747 \374 | ||
var CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
var STRINGS = { | ||
const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'; | ||
const STRINGS = { | ||
className: 'string', | ||
variants: [ | ||
{ | ||
begin: '(u8?|U|L)?"', end: '"', | ||
begin: '(u8?|U|L)?"', | ||
end: '"', | ||
illegal: '\\n', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
contains: [ hljs.BACKSLASH_ESCAPE ] | ||
}, | ||
{ | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", end: '\'', | ||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", | ||
end: '\'', | ||
illegal: '.' | ||
@@ -57,3 +86,3 @@ }, | ||
begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/, | ||
end: /\)([^()\\ ]{0,16})"/, | ||
end: /\)([^()\\ ]{0,16})"/ | ||
}) | ||
@@ -63,8 +92,14 @@ ] | ||
var NUMBERS = { | ||
const NUMBERS = { | ||
className: 'number', | ||
variants: [ | ||
{ begin: '\\b(0b[01\']+)' }, | ||
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' }, | ||
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' } | ||
{ | ||
begin: '\\b(0b[01\']+)' | ||
}, | ||
{ | ||
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' | ||
}, | ||
{ | ||
begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' | ||
} | ||
], | ||
@@ -74,5 +109,6 @@ relevance: 0 | ||
var PREPROCESSOR = { | ||
const PREPROCESSOR = { | ||
className: 'meta', | ||
begin: /#\s*[a-z]+\b/, end: /$/, | ||
begin: /#\s*[a-z]+\b/, | ||
end: /$/, | ||
keywords: { | ||
@@ -85,9 +121,13 @@ 'meta-keyword': | ||
{ | ||
begin: /\\\n/, relevance: 0 | ||
begin: /\\\n/, | ||
relevance: 0 | ||
}, | ||
hljs.inherit(STRINGS, {className: 'meta-string'}), | ||
hljs.inherit(STRINGS, { | ||
className: 'meta-string' | ||
}), | ||
{ | ||
className: 'meta-string', | ||
begin: /<.*?>/, end: /$/, | ||
illegal: '\\n', | ||
begin: /<.*?>/, | ||
end: /$/, | ||
illegal: '\\n' | ||
}, | ||
@@ -99,3 +139,3 @@ C_LINE_COMMENT_MODE, | ||
var TITLE_MODE = { | ||
const TITLE_MODE = { | ||
className: 'title', | ||
@@ -106,5 +146,5 @@ begin: optional(NAMESPACE_RE) + hljs.IDENT_RE, | ||
var FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\('; | ||
var CPP_KEYWORDS = { | ||
const CPP_KEYWORDS = { | ||
keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' + | ||
@@ -134,3 +174,3 @@ 'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' + | ||
var EXPRESSION_CONTAINS = [ | ||
const EXPRESSION_CONTAINS = [ | ||
PREPROCESSOR, | ||
@@ -144,3 +184,3 @@ CPP_PRIMITIVE_TYPES, | ||
var EXPRESSION_CONTEXT = { | ||
const EXPRESSION_CONTEXT = { | ||
// This mode covers expression context where we can't expect a function | ||
@@ -150,5 +190,14 @@ // definition and shouldn't highlight anything that looks like one: | ||
variants: [ | ||
{begin: /=/, end: /;/}, | ||
{begin: /\(/, end: /\)/}, | ||
{beginKeywords: 'new throw return else', end: /;/} | ||
{ | ||
begin: /=/, | ||
end: /;/ | ||
}, | ||
{ | ||
begin: /\(/, | ||
end: /\)/ | ||
}, | ||
{ | ||
beginKeywords: 'new throw return else', | ||
end: /;/ | ||
} | ||
], | ||
@@ -158,5 +207,6 @@ keywords: CPP_KEYWORDS, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
contains: EXPRESSION_CONTAINS.concat(['self']), | ||
contains: EXPRESSION_CONTAINS.concat([ 'self' ]), | ||
relevance: 0 | ||
@@ -168,6 +218,7 @@ } | ||
var FUNCTION_DECLARATION = { | ||
const FUNCTION_DECLARATION = { | ||
className: 'function', | ||
begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE, | ||
returnBegin: true, end: /[{;=]/, | ||
returnBegin: true, | ||
end: /[{;=]/, | ||
excludeEnd: true, | ||
@@ -177,11 +228,11 @@ keywords: CPP_KEYWORDS, | ||
contains: [ | ||
{ // to prevent it from being confused as the function title | ||
begin: DECLTYPE_AUTO_RE, | ||
keywords: CPP_KEYWORDS, | ||
relevance: 0, | ||
relevance: 0 | ||
}, | ||
{ | ||
begin: FUNCTION_TITLE, returnBegin: true, | ||
contains: [TITLE_MODE], | ||
begin: FUNCTION_TITLE, | ||
returnBegin: true, | ||
contains: [ TITLE_MODE ], | ||
relevance: 0 | ||
@@ -191,3 +242,4 @@ }, | ||
className: 'params', | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -203,3 +255,4 @@ relevance: 0, | ||
{ | ||
begin: /\(/, end: /\)/, | ||
begin: /\(/, | ||
end: /\)/, | ||
keywords: CPP_KEYWORDS, | ||
@@ -226,3 +279,13 @@ relevance: 0, | ||
return { | ||
aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'], | ||
aliases: [ | ||
'c', | ||
'cc', | ||
'h', | ||
'c++', | ||
'h++', | ||
'hpp', | ||
'hh', | ||
'hxx', | ||
'cxx' | ||
], | ||
keywords: CPP_KEYWORDS, | ||
@@ -238,21 +301,28 @@ // the base c-like language will NEVER be auto-detected, rather the | ||
[ | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: ['self', CPP_PRIMITIVE_TYPES] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', end: /[{;:<>=]/, | ||
contains: [ | ||
{ beginKeywords: "final class struct" }, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
PREPROCESSOR, | ||
{ // containers: ie, `vector <int> rooms (9);` | ||
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', | ||
end: '>', | ||
keywords: CPP_KEYWORDS, | ||
contains: [ | ||
'self', | ||
CPP_PRIMITIVE_TYPES | ||
] | ||
}, | ||
{ | ||
begin: hljs.IDENT_RE + '::', | ||
keywords: CPP_KEYWORDS | ||
}, | ||
{ | ||
className: 'class', | ||
beginKeywords: 'enum class struct union', | ||
end: /[{;:<>=]/, | ||
contains: [ | ||
{ | ||
beginKeywords: "final class struct" | ||
}, | ||
hljs.TITLE_MODE | ||
] | ||
} | ||
]), | ||
exports: { | ||
@@ -259,0 +329,0 @@ preprocessor: PREPROCESSOR, |
@@ -9,4 +9,4 @@ /* | ||
function crystal(hljs) { | ||
var INT_SUFFIX = '(_*[ui](8|16|32|64|128))?'; | ||
var FLOAT_SUFFIX = '(_*f(32|64))?'; | ||
var INT_SUFFIX = '(_?[ui](8|16|32|64|128))?'; | ||
var FLOAT_SUFFIX = '(_?f(32|64))?'; | ||
var CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?'; | ||
@@ -181,3 +181,3 @@ var CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?'; | ||
{ begin: '\\b0x([A-Fa-f0-9_]+)' + INT_SUFFIX }, | ||
{ begin: '\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_*[-+]?[0-9_]*)?' + FLOAT_SUFFIX + '(?!_)' }, | ||
{ begin: '\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_?[-+]?[0-9_]*)?' + FLOAT_SUFFIX + '(?!_)' }, | ||
{ begin: '\\b([1-9][0-9_]*|0)' + INT_SUFFIX } | ||
@@ -184,0 +184,0 @@ ], |
@@ -328,3 +328,3 @@ /* | ||
className: 'function', | ||
begin: '(' + TYPE_IDENT_RE + '\\s+)+' + hljs.IDENT_RE + '\\s*(<.+>)?\\s*\\(', returnBegin: true, | ||
begin: '(' + TYPE_IDENT_RE + '\\s+)+' + hljs.IDENT_RE + '\\s*(<.+>\\s*)?\\(', returnBegin: true, | ||
end: /\s*[{;=]/, excludeEnd: true, | ||
@@ -339,3 +339,3 @@ keywords: KEYWORDS, | ||
{ | ||
begin: hljs.IDENT_RE + '\\s*(<.+>)?\\s*\\(', returnBegin: true, | ||
begin: hljs.IDENT_RE + '\\s*(<.+>\\s*)?\\(', returnBegin: true, | ||
contains: [ | ||
@@ -342,0 +342,0 @@ hljs.TITLE_MODE, |
@@ -65,3 +65,3 @@ /* | ||
const decimal_float_re = '(' + decimal_integer_nosus_re + '(\\.\\d*|' + decimal_exponent_re + ')|' + | ||
'\\d+\\.' + decimal_integer_nosus_re + decimal_integer_nosus_re + '|' + | ||
'\\d+\\.' + decimal_integer_nosus_re + '|' + | ||
'\\.' + decimal_integer_re + decimal_exponent_re + '?' + | ||
@@ -68,0 +68,0 @@ ')'; |
@@ -28,4 +28,4 @@ /* | ||
className: 'string', | ||
begin: /\w+-?\w+/, | ||
end: /\W/, | ||
begin: /\w+(\-\w+)*/, | ||
end: /(?=\W)/, | ||
relevance: 0 | ||
@@ -32,0 +32,0 @@ }; |
@@ -13,3 +13,3 @@ /* | ||
className: "attribute", | ||
begin: /^[ ]*[a-zA-Z][a-zA-Z_-]*([\s_-]+[a-zA-Z][a-zA-Z]*)*/ | ||
begin: /^[ ]*[a-zA-Z]+([\s_-]+[a-zA-Z]+)*/ | ||
}; | ||
@@ -16,0 +16,0 @@ |
@@ -27,3 +27,3 @@ /* | ||
className: 'number', | ||
begin: '(\\b0o[0-7_]+)|(\\b0b[01_]+)|(\\b0x[0-9a-fA-F_]+)|(-?\\b[1-9][0-9_]*(.[0-9_]+([eE][-+]?[0-9]+)?)?)', | ||
begin: '(\\b0o[0-7_]+)|(\\b0b[01_]+)|(\\b0x[0-9a-fA-F_]+)|(-?\\b[1-9][0-9_]*(\\.[0-9_]+([eE][-+]?[0-9]+)?)?)', | ||
relevance: 0 | ||
@@ -30,0 +30,0 @@ }; |
@@ -0,1 +1,26 @@ | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/* | ||
@@ -34,3 +59,7 @@ Language: Erlang REPL | ||
{ | ||
begin: '\\?(::)?([A-Z]\\w*(::)?)+' | ||
begin: concat( | ||
/\?(::)?/, | ||
/([A-Z]\w*)/, // at least one identifier | ||
/((::)[A-Z]\w*)*/ // perhaps more | ||
) | ||
}, | ||
@@ -37,0 +66,0 @@ { |
@@ -0,1 +1,26 @@ | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/* | ||
@@ -31,6 +56,18 @@ Language: Fortran | ||
// regex in both fortran and irpf90 should match | ||
const OPTIONAL_NUMBER_SUFFIX = /(_[a-z_\d]+)?/; | ||
const OPTIONAL_NUMBER_EXP = /([de][+-]?\d+)?/; | ||
const NUMBER = { | ||
className: 'number', | ||
// regex in both fortran and irpf90 should match | ||
begin: '(?=\\b|\\+|-|\\.)(?:\\.|\\d+\\.?)\\d*([de][+-]?\\d+)?(_[a-z_\\d]+)?', | ||
variants: [ | ||
{ | ||
begin: concat(/\b\d+/, /\.(\d*)/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX) | ||
}, | ||
{ | ||
begin: concat(/\b\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX) | ||
}, | ||
{ | ||
begin: concat(/\.\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX) | ||
} | ||
], | ||
relevance: 0 | ||
@@ -37,0 +74,0 @@ }; |
@@ -1,10 +0,35 @@ | ||
/* | ||
Language: GAMS | ||
Author: Stefan Bechert <stefan.bechert@gmx.net> | ||
Contributors: Oleg Efimov <efimovov@gmail.com>, Mikko Kouhia <mikko.kouhia@iki.fi> | ||
Description: The General Algebraic Modeling System language | ||
Website: https://www.gams.com | ||
Category: scientific | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function anyNumberOfTimes(re) { | ||
return concat('(', re, ')*'); | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/** @type LanguageFn */ | ||
function gams(hljs) { | ||
@@ -82,2 +107,3 @@ const KEYWORDS = { | ||
}; | ||
const COMMENT_WORD = /[a-z0-9&#*=?@\\><:,()$[\]_.{}!+%^-]+/; | ||
const DESCTEXT = { // Parameter/set/variable description text | ||
@@ -93,3 +119,8 @@ begin: /[a-z][a-z0-9_]*(\([a-z0-9_, ]*\))?[ \t]+/, | ||
className: 'comment', | ||
begin: /([ ]*[a-z0-9&#*=?@\\><:,()$[\]_.{}!+%^-]+)+/, | ||
// one comment word, then possibly more | ||
begin: concat( | ||
COMMENT_WORD, | ||
// [ ] because \s would be too broad (matching newlines) | ||
anyNumberOfTimes(concat(/[ ]+/, COMMENT_WORD)) | ||
), | ||
relevance: 0 | ||
@@ -96,0 +127,0 @@ } |
@@ -20,2 +20,5 @@ /* | ||
}; | ||
const NUMBER = hljs.inherit(hljs.C_NUMBER_MODE, { | ||
begin: '([-+]?((\\.\\d+)|(\\d+)(\\.\\d*)?))|' + hljs.C_NUMBER_RE | ||
}); | ||
const GCODE_CODE = [ | ||
@@ -25,5 +28,3 @@ hljs.C_LINE_COMMENT_MODE, | ||
hljs.COMMENT(/\(/, /\)/), | ||
hljs.inherit(hljs.C_NUMBER_MODE, { | ||
begin: '([-+]?([0-9]*\\.?[0-9]+\\.?))|' + hljs.C_NUMBER_RE | ||
}), | ||
NUMBER, | ||
hljs.inherit(hljs.APOS_STRING_MODE, { | ||
@@ -55,3 +56,6 @@ illegal: null | ||
begin: '(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)', | ||
end: '([-+]?([0-9]*\\.?[0-9]+\\.?))(\\])' | ||
contains: [ | ||
NUMBER | ||
], | ||
end: '\\]' | ||
}, | ||
@@ -58,0 +62,0 @@ { |
@@ -18,2 +18,18 @@ /** | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function anyNumberOfTimes(re) { | ||
return concat('(', re, ')*'); | ||
} | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function optional(re) { | ||
return concat('(', re, ')?'); | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
@@ -27,2 +43,14 @@ * @returns {string} | ||
/** | ||
* Any of the passed expresssions may match | ||
* | ||
* Creates a huge this | this | that | that match | ||
* @param {(RegExp | string)[] } args | ||
* @returns {string} | ||
*/ | ||
function either(...args) { | ||
const joined = '(' + args.map((x) => source(x)).join("|") + ")"; | ||
return joined; | ||
} | ||
/* | ||
@@ -85,16 +113,21 @@ Language: Handlebars | ||
const DOUBLE_QUOTED_ID_REGEX = /".*?"/; | ||
const SINGLE_QUOTED_ID_REGEX = /'.*?'/; | ||
const BRACKET_QUOTED_ID_REGEX = /\[.*?\]/; | ||
const DOUBLE_QUOTED_ID_REGEX = /""|"[^"]+"/; | ||
const SINGLE_QUOTED_ID_REGEX = /''|'[^']+'/; | ||
const BRACKET_QUOTED_ID_REGEX = /\[\]|\[[^\]]+\]/; | ||
const PLAIN_ID_REGEX = /[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/; | ||
const PATH_DELIMITER_REGEX = /\.|\//; | ||
const PATH_DELIMITER_REGEX = /(\.|\/)/; | ||
const ANY_ID = either( | ||
DOUBLE_QUOTED_ID_REGEX, | ||
SINGLE_QUOTED_ID_REGEX, | ||
BRACKET_QUOTED_ID_REGEX, | ||
PLAIN_ID_REGEX | ||
); | ||
const IDENTIFIER_REGEX = concat( | ||
'(', | ||
SINGLE_QUOTED_ID_REGEX, '|', | ||
DOUBLE_QUOTED_ID_REGEX, '|', | ||
BRACKET_QUOTED_ID_REGEX, '|', | ||
PLAIN_ID_REGEX, '|', | ||
PATH_DELIMITER_REGEX, | ||
')+' | ||
optional(/\.|\.\/|\//), // relative or absolute path | ||
ANY_ID, | ||
anyNumberOfTimes(concat( | ||
PATH_DELIMITER_REGEX, | ||
ANY_ID | ||
)) | ||
); | ||
@@ -101,0 +134,0 @@ |
@@ -18,2 +18,18 @@ /** | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function anyNumberOfTimes(re) { | ||
return concat('(', re, ')*'); | ||
} | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function optional(re) { | ||
return concat('(', re, ')?'); | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
@@ -27,2 +43,14 @@ * @returns {string} | ||
/** | ||
* Any of the passed expresssions may match | ||
* | ||
* Creates a huge this | this | that | that match | ||
* @param {(RegExp | string)[] } args | ||
* @returns {string} | ||
*/ | ||
function either(...args) { | ||
const joined = '(' + args.map((x) => source(x)).join("|") + ")"; | ||
return joined; | ||
} | ||
/* | ||
@@ -85,16 +113,21 @@ Language: Handlebars | ||
const DOUBLE_QUOTED_ID_REGEX = /".*?"/; | ||
const SINGLE_QUOTED_ID_REGEX = /'.*?'/; | ||
const BRACKET_QUOTED_ID_REGEX = /\[.*?\]/; | ||
const DOUBLE_QUOTED_ID_REGEX = /""|"[^"]+"/; | ||
const SINGLE_QUOTED_ID_REGEX = /''|'[^']+'/; | ||
const BRACKET_QUOTED_ID_REGEX = /\[\]|\[[^\]]+\]/; | ||
const PLAIN_ID_REGEX = /[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/; | ||
const PATH_DELIMITER_REGEX = /\.|\//; | ||
const PATH_DELIMITER_REGEX = /(\.|\/)/; | ||
const ANY_ID = either( | ||
DOUBLE_QUOTED_ID_REGEX, | ||
SINGLE_QUOTED_ID_REGEX, | ||
BRACKET_QUOTED_ID_REGEX, | ||
PLAIN_ID_REGEX | ||
); | ||
const IDENTIFIER_REGEX = concat( | ||
'(', | ||
SINGLE_QUOTED_ID_REGEX, '|', | ||
DOUBLE_QUOTED_ID_REGEX, '|', | ||
BRACKET_QUOTED_ID_REGEX, '|', | ||
PLAIN_ID_REGEX, '|', | ||
PATH_DELIMITER_REGEX, | ||
')+' | ||
optional(/\.|\.\/|\//), // relative or absolute path | ||
ANY_ID, | ||
anyNumberOfTimes(concat( | ||
PATH_DELIMITER_REGEX, | ||
ANY_ID | ||
)) | ||
); | ||
@@ -101,0 +134,0 @@ |
@@ -0,1 +1,26 @@ | ||
/** | ||
* @param {string} value | ||
* @returns {RegExp} | ||
* */ | ||
/** | ||
* @param {RegExp | string } re | ||
* @returns {string} | ||
*/ | ||
function source(re) { | ||
if (!re) return null; | ||
if (typeof re === "string") return re; | ||
return re.source; | ||
} | ||
/** | ||
* @param {...(RegExp | string) } args | ||
* @returns {string} | ||
*/ | ||
function concat(...args) { | ||
const joined = args.map((x) => source(x)).join(""); | ||
return joined; | ||
} | ||
/* | ||
@@ -9,2 +34,3 @@ Language: IRPF90 | ||
/** @type LanguageFn */ | ||
function irpf90(hljs) { | ||
@@ -17,2 +43,21 @@ const PARAMS = { | ||
// regex in both fortran and irpf90 should match | ||
const OPTIONAL_NUMBER_SUFFIX = /(_[a-z_\d]+)?/; | ||
const OPTIONAL_NUMBER_EXP = /([de][+-]?\d+)?/; | ||
const NUMBER = { | ||
className: 'number', | ||
variants: [ | ||
{ | ||
begin: concat(/\b\d+/, /\.(\d*)/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX) | ||
}, | ||
{ | ||
begin: concat(/\b\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX) | ||
}, | ||
{ | ||
begin: concat(/\.\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX) | ||
} | ||
], | ||
relevance: 0 | ||
}; | ||
const F_KEYWORDS = { | ||
@@ -93,8 +138,3 @@ literal: '.False. .True.', | ||
}), | ||
{ | ||
className: 'number', | ||
// regex in both fortran and irpf90 should match | ||
begin: '(?=\\b|\\+|-|\\.)(?:\\.|\\d+\\.?)\\d*([de][+-]?\\d+)?(_[a-z_\\d]+)?', | ||
relevance: 0 | ||
} | ||
NUMBER | ||
] | ||
@@ -101,0 +141,0 @@ }; |
@@ -0,1 +1,36 @@ | ||
// https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10 | ||
var decimalDigits = '[0-9](_*[0-9])*'; | ||
var frac = `\\.(${decimalDigits})`; | ||
var hexDigits = '[0-9a-fA-F](_*[0-9a-fA-F])*'; | ||
var NUMERIC = { | ||
className: 'number', | ||
variants: [ | ||
// DecimalFloatingPointLiteral | ||
// including ExponentPart | ||
{ begin: `(\\b(${decimalDigits})((${frac})|\\.)?|(${frac}))` + | ||
`[eE][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
// excluding ExponentPart | ||
{ begin: `\\b(${decimalDigits})((${frac})[fFdD]?\\b|\\.([fFdD]\\b)?)` }, | ||
{ begin: `(${frac})[fFdD]?\\b` }, | ||
{ begin: `\\b(${decimalDigits})[fFdD]\\b` }, | ||
// HexadecimalFloatingPointLiteral | ||
{ begin: `\\b0[xX]((${hexDigits})\\.?|(${hexDigits})?\\.(${hexDigits}))` + | ||
`[pP][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
// DecimalIntegerLiteral | ||
{ begin: '\\b(0|[1-9](_*[0-9])*)[lL]?\\b' }, | ||
// HexIntegerLiteral | ||
{ begin: `\\b0[xX](${hexDigits})[lL]?\\b` }, | ||
// OctalIntegerLiteral | ||
{ begin: '\\b0(_*[0-7])*[lL]?\\b' }, | ||
// BinaryIntegerLiteral | ||
{ begin: '\\b0[bB][01](_*[01])*[lL]?\\b' }, | ||
], | ||
relevance: 0 | ||
}; | ||
/* | ||
@@ -28,38 +63,4 @@ Language: Java | ||
}; | ||
const NUMBER = NUMERIC; | ||
// https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10 | ||
var decimalDigits = '[0-9](_*[0-9])*'; | ||
var frac = `\\.(${decimalDigits})`; | ||
var hexDigits = '[0-9a-fA-F](_*[0-9a-fA-F])*'; | ||
var NUMBER = { | ||
className: 'number', | ||
variants: [ | ||
// DecimalFloatingPointLiteral | ||
// including ExponentPart | ||
{ begin: `(\\b(${decimalDigits})((${frac})|\\.)?|(${frac}))` + | ||
`[eE][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
// excluding ExponentPart | ||
{ begin: `\\b(${decimalDigits})((${frac})[fFdD]?\\b|\\.([fFdD]\\b)?)` }, | ||
{ begin: `(${frac})[fFdD]?\\b` }, | ||
{ begin: `\\b(${decimalDigits})[fFdD]\\b` }, | ||
// HexadecimalFloatingPointLiteral | ||
{ begin: `\\b0[xX]((${hexDigits})\\.?|(${hexDigits})?\\.(${hexDigits}))` + | ||
`[pP][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
// DecimalIntegerLiteral | ||
{ begin: '\\b(0|[1-9](_*[0-9])*)[lL]?\\b' }, | ||
// HexIntegerLiteral | ||
{ begin: `\\b0[xX](${hexDigits})[lL]?\\b` }, | ||
// OctalIntegerLiteral | ||
{ begin: '\\b0(_*[0-7])*[lL]?\\b' }, | ||
// BinaryIntegerLiteral | ||
{ begin: '\\b0[bB][01](_*[01])*[lL]?\\b' }, | ||
], | ||
relevance: 0 | ||
}; | ||
return { | ||
@@ -66,0 +67,0 @@ name: 'Java', |
@@ -453,4 +453,4 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; | ||
'[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\)[^()]*)*' + | ||
'\\)[^()]*)*' + | ||
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>', | ||
@@ -545,4 +545,4 @@ returnBegin: true, | ||
'[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\)[^()]*)*' + | ||
'\\)[^()]*)*' + | ||
'\\)\\s*\\{', // end parens | ||
@@ -549,0 +549,0 @@ returnBegin:true, |
@@ -35,3 +35,3 @@ /* | ||
className: 'string', | ||
begin: /\B(([\/.])[\w\-.\/=]+)+/ | ||
begin: /\B([\/.])[\w\-.\/=]+/ | ||
}; | ||
@@ -38,0 +38,0 @@ const COMMAND_PARAMS = { |
@@ -0,1 +1,36 @@ | ||
// https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10 | ||
var decimalDigits = '[0-9](_*[0-9])*'; | ||
var frac = `\\.(${decimalDigits})`; | ||
var hexDigits = '[0-9a-fA-F](_*[0-9a-fA-F])*'; | ||
var NUMERIC = { | ||
className: 'number', | ||
variants: [ | ||
// DecimalFloatingPointLiteral | ||
// including ExponentPart | ||
{ begin: `(\\b(${decimalDigits})((${frac})|\\.)?|(${frac}))` + | ||
`[eE][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
// excluding ExponentPart | ||
{ begin: `\\b(${decimalDigits})((${frac})[fFdD]?\\b|\\.([fFdD]\\b)?)` }, | ||
{ begin: `(${frac})[fFdD]?\\b` }, | ||
{ begin: `\\b(${decimalDigits})[fFdD]\\b` }, | ||
// HexadecimalFloatingPointLiteral | ||
{ begin: `\\b0[xX]((${hexDigits})\\.?|(${hexDigits})?\\.(${hexDigits}))` + | ||
`[pP][+-]?(${decimalDigits})[fFdD]?\\b` }, | ||
// DecimalIntegerLiteral | ||
{ begin: '\\b(0|[1-9](_*[0-9])*)[lL]?\\b' }, | ||
// HexIntegerLiteral | ||
{ begin: `\\b0[xX](${hexDigits})[lL]?\\b` }, | ||
// OctalIntegerLiteral | ||
{ begin: '\\b0(_*[0-7])*[lL]?\\b' }, | ||
// BinaryIntegerLiteral | ||
{ begin: '\\b0[bB][01](_*[01])*[lL]?\\b' }, | ||
], | ||
relevance: 0 | ||
}; | ||
/* | ||
@@ -107,21 +142,3 @@ Language: Kotlin | ||
// so the code below is copied from java.js | ||
const KOTLIN_NUMBER_RE = '\\b' + | ||
'(' + | ||
'0[bB]([01]+[01_]+[01]+|[01]+)' + // 0b... | ||
'|' + | ||
'0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)' + // 0x... | ||
'|' + | ||
'(' + | ||
'([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?' + | ||
'|' + | ||
'\\.([\\d]+[\\d_]+[\\d]+|[\\d]+)' + | ||
')' + | ||
'([eE][-+]?\\d+)?' + // octal, decimal, float | ||
')' + | ||
'[lLfF]?'; | ||
const KOTLIN_NUMBER_MODE = { | ||
className: 'number', | ||
begin: KOTLIN_NUMBER_RE, | ||
relevance: 0 | ||
}; | ||
const KOTLIN_NUMBER_MODE = NUMERIC; | ||
const KOTLIN_NESTED_COMMENT = hljs.COMMENT( | ||
@@ -181,3 +198,2 @@ '/\\*', '\\*/', | ||
keywords: KEYWORDS, | ||
illegal: /fun\s+(<.*>)?[^\s\(]+(\s+[^\s\(]+)\s*=/, | ||
relevance: 5, | ||
@@ -184,0 +200,0 @@ contains: [ |
@@ -201,3 +201,3 @@ /** | ||
{ | ||
begin: '\\\\begin(?=\\s*\\r?\\n?\\s*\\{' + envname + '\\})', | ||
begin: '\\\\begin(?=[ \t]*(\\r?\\n[ \t]*)?\\{' + envname + '\\})', | ||
keywords: {$pattern: /\\[a-zA-Z]+/, keyword: '\\begin'}, | ||
@@ -204,0 +204,0 @@ relevance: 0, |
@@ -32,3 +32,3 @@ /* | ||
{ | ||
begin: '\\b_*rig[A-Z]+[A-Za-z0-9_\\-]*' | ||
begin: '\\b_*rig[A-Z][A-Za-z0-9_\\-]*' | ||
}, | ||
@@ -35,0 +35,0 @@ { |
@@ -332,11 +332,11 @@ const KEYWORDS = [ | ||
{ | ||
begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B->\\*?', | ||
begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?(\\(.*\\)\\s*)?\\B->\\*?', | ||
end: '->\\*?' | ||
}, | ||
{ | ||
begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?!?(\\(.*\\))?\\s*\\B[-~]{1,2}>\\*?', | ||
begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?!?(\\(.*\\)\\s*)?\\B[-~]{1,2}>\\*?', | ||
end: '[-~]{1,2}>\\*?' | ||
}, | ||
{ | ||
begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B!?[-~]{1,2}>\\*?', | ||
begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?(\\(.*\\)\\s*)?\\B!?[-~]{1,2}>\\*?', | ||
end: '!?[-~]{1,2}>\\*?' | ||
@@ -343,0 +343,0 @@ } |
@@ -50,6 +50,6 @@ /** | ||
{ | ||
begin: '(`{3,})(.|\\n)*?\\1`*[ ]*' | ||
begin: '(`{3,})[^`](.|\\n)*?\\1`*[ ]*' | ||
}, | ||
{ | ||
begin: '(~{3,})(.|\\n)*?\\1~*[ ]*' | ||
begin: '(~{3,})[^~](.|\\n)*?\\1~*[ ]*' | ||
}, | ||
@@ -56,0 +56,0 @@ // needed to allow markdown as a sublanguage to work |
@@ -73,3 +73,3 @@ /* | ||
}); | ||
const PARAMS_RE = '(\\(.*\\))?\\s*\\B[-=]>'; | ||
const POSSIBLE_PARAMS_RE = '(\\(.*\\)\\s*)?\\B[-=]>'; | ||
const PARAMS = { | ||
@@ -100,3 +100,3 @@ className: 'params', | ||
className: 'function', // function: -> => | ||
begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + PARAMS_RE, | ||
begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + POSSIBLE_PARAMS_RE, | ||
end: '[-=]>', | ||
@@ -115,3 +115,3 @@ returnBegin: true, | ||
className: 'function', | ||
begin: PARAMS_RE, | ||
begin: POSSIBLE_PARAMS_RE, | ||
end: '[-=]>', | ||
@@ -118,0 +118,0 @@ returnBegin: true, |
@@ -35,3 +35,5 @@ /** | ||
function perl(hljs) { | ||
var PERL_KEYWORDS = { | ||
// https://perldoc.perl.org/perlre#Modifiers | ||
const REGEX_MODIFIERS = /[dualxmsipn]{0,12}/; // aa and xx are valid, making max length 12 | ||
const PERL_KEYWORDS = { | ||
$pattern: /[\w.]+/, | ||
@@ -58,25 +60,38 @@ keyword: 'getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ' + | ||
}; | ||
var SUBST = { | ||
const SUBST = { | ||
className: 'subst', | ||
begin: '[$@]\\{', end: '\\}', | ||
begin: '[$@]\\{', | ||
end: '\\}', | ||
keywords: PERL_KEYWORDS | ||
}; | ||
var METHOD = { | ||
begin: /->\{/, end: /\}/ | ||
const METHOD = { | ||
begin: /->\{/, | ||
end: /\}/ | ||
// contains defined later | ||
}; | ||
var VAR = { | ||
const VAR = { | ||
variants: [ | ||
{begin: /\$\d/}, | ||
{begin: concat( | ||
/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, | ||
// negative look-ahead tries to avoid matching patterns that are not | ||
// Perl at all like $ident$, @ident@, etc. | ||
`(?![A-Za-z])(?![@$%])` | ||
)}, | ||
{begin: /[$%@][^\s\w{]/, relevance: 0} | ||
{ | ||
begin: /\$\d/ | ||
}, | ||
{ | ||
begin: concat( | ||
/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, | ||
// negative look-ahead tries to avoid matching patterns that are not | ||
// Perl at all like $ident$, @ident@, etc. | ||
`(?![A-Za-z])(?![@$%])` | ||
) | ||
}, | ||
{ | ||
begin: /[$%@][^\s\w{]/, | ||
relevance: 0 | ||
} | ||
] | ||
}; | ||
var STRING_CONTAINS = [hljs.BACKSLASH_ESCAPE, SUBST, VAR]; | ||
var PERL_DEFAULT_CONTAINS = [ | ||
const STRING_CONTAINS = [ | ||
hljs.BACKSLASH_ESCAPE, | ||
SUBST, | ||
VAR | ||
]; | ||
const PERL_DEFAULT_CONTAINS = [ | ||
VAR, | ||
@@ -97,35 +112,44 @@ hljs.HASH_COMMENT_MODE, | ||
{ | ||
begin: 'q[qwxr]?\\s*\\(', end: '\\)', | ||
begin: 'q[qwxr]?\\s*\\(', | ||
end: '\\)', | ||
relevance: 5 | ||
}, | ||
{ | ||
begin: 'q[qwxr]?\\s*\\[', end: '\\]', | ||
begin: 'q[qwxr]?\\s*\\[', | ||
end: '\\]', | ||
relevance: 5 | ||
}, | ||
{ | ||
begin: 'q[qwxr]?\\s*\\{', end: '\\}', | ||
begin: 'q[qwxr]?\\s*\\{', | ||
end: '\\}', | ||
relevance: 5 | ||
}, | ||
{ | ||
begin: 'q[qwxr]?\\s*\\|', end: '\\|', | ||
begin: 'q[qwxr]?\\s*\\|', | ||
end: '\\|', | ||
relevance: 5 | ||
}, | ||
{ | ||
begin: 'q[qwxr]?\\s*<', end: '>', | ||
begin: 'q[qwxr]?\\s*<', | ||
end: '>', | ||
relevance: 5 | ||
}, | ||
{ | ||
begin: 'qw\\s+q', end: 'q', | ||
begin: 'qw\\s+q', | ||
end: 'q', | ||
relevance: 5 | ||
}, | ||
{ | ||
begin: '\'', end: '\'', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
begin: '\'', | ||
end: '\'', | ||
contains: [ hljs.BACKSLASH_ESCAPE ] | ||
}, | ||
{ | ||
begin: '"', end: '"' | ||
begin: '"', | ||
end: '"' | ||
}, | ||
{ | ||
begin: '`', end: '`', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
begin: '`', | ||
end: '`', | ||
contains: [ hljs.BACKSLASH_ESCAPE ] | ||
}, | ||
@@ -157,3 +181,11 @@ { | ||
className: 'regexp', | ||
begin: '(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*', | ||
begin: concat( | ||
/(s|tr|y)/, | ||
/\//, | ||
/(\\.|[^\\\/])*/, | ||
/\//, | ||
/(\\.|[^\\\/])*/, | ||
/\//, | ||
REGEX_MODIFIERS, | ||
), | ||
relevance: 10 | ||
@@ -163,4 +195,8 @@ }, | ||
className: 'regexp', | ||
begin: '(m|qr)?/', end: '/[a-z]*', | ||
contains: [hljs.BACKSLASH_ESCAPE], | ||
begin: /(m|qr)?\//, | ||
end: concat( | ||
/\//, | ||
REGEX_MODIFIERS | ||
), | ||
contains: [ hljs.BACKSLASH_ESCAPE ], | ||
relevance: 0 // allows empty "//" which is a common comment delimiter in other languages | ||
@@ -172,5 +208,7 @@ } | ||
className: 'function', | ||
beginKeywords: 'sub', end: '(\\s*\\(.*?\\))?[;{]', excludeEnd: true, | ||
beginKeywords: 'sub', | ||
end: '(\\s*\\(.*?\\))?[;{]', | ||
excludeEnd: true, | ||
relevance: 5, | ||
contains: [hljs.TITLE_MODE] | ||
contains: [ hljs.TITLE_MODE ] | ||
}, | ||
@@ -187,5 +225,5 @@ { | ||
{ | ||
begin: "^@@.*", | ||
end: "$", | ||
className: "comment" | ||
begin: "^@@.*", | ||
end: "$", | ||
className: "comment" | ||
} | ||
@@ -200,3 +238,6 @@ ] | ||
name: 'Perl', | ||
aliases: ['pl', 'pm'], | ||
aliases: [ | ||
'pl', | ||
'pm' | ||
], | ||
keywords: PERL_KEYWORDS, | ||
@@ -203,0 +244,0 @@ contains: PERL_DEFAULT_CONTAINS |
@@ -34,3 +34,3 @@ /* | ||
'ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|' + | ||
'Limit|Merge|New|Out|Publish|Restore|Save|Sync|Unpublish|Update|' + | ||
'Limit|Merge|Out|Publish|Restore|Save|Sync|Unpublish|Update|' + | ||
'Approve|Assert|Complete|Confirm|Deny|Disable|Enable|Install|Invoke|Register|' + | ||
@@ -37,0 +37,0 @@ 'Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|' + |
@@ -123,3 +123,3 @@ /** | ||
{ begin: IDENT_RE }, | ||
{ begin: /`(?:\\.|[^`])+`/ } | ||
{ begin: /`(?:\\.|[^`\\])+`/ } | ||
], | ||
@@ -126,0 +126,0 @@ endsParent: true |
@@ -26,4 +26,4 @@ /* | ||
const RE_PARAM_TYPEPARAM = '\'?[a-z$_][0-9a-z$_]*'; | ||
const RE_PARAM_TYPE = '\s*:\s*[a-z$_][0-9a-z$_]*(\(\s*(' + RE_PARAM_TYPEPARAM + '\s*(,' + RE_PARAM_TYPEPARAM + ')*)?\s*\))?'; | ||
const RE_PARAM = RE_IDENT + '(' + RE_PARAM_TYPE + ')?(' + RE_PARAM_TYPE + ')?'; | ||
const RE_PARAM_TYPE = '\\s*:\\s*[a-z$_][0-9a-z$_]*(\\(\\s*(' + RE_PARAM_TYPEPARAM + '\\s*(,' + RE_PARAM_TYPEPARAM + '\\s*)*)?\\))?'; | ||
const RE_PARAM = RE_IDENT + '(' + RE_PARAM_TYPE + '){0,2}'; | ||
const RE_OPERATOR = "(" + orReValues([ | ||
@@ -30,0 +30,0 @@ '||', |
@@ -25,3 +25,3 @@ /* | ||
const OBJECTS = 'traffic-flow traffic-generator firewall scheduler aaa accounting address-list address align area bandwidth-server bfd bgp bridge client clock community config connection console customer default dhcp-client dhcp-server discovery dns e-mail ethernet filter firewall firmware gps graphing group hardware health hotspot identity igmp-proxy incoming instance interface ip ipsec ipv6 irq l2tp-server lcd ldp logging mac-server mac-winbox mangle manual mirror mme mpls nat nd neighbor network note ntp ospf ospf-v3 ovpn-server page peer pim ping policy pool port ppp pppoe-client pptp-server prefix profile proposal proxy queue radius resource rip ripng route routing screen script security-profiles server service service-port settings shares smb sms sniffer snmp snooper socks sstp-server system tool tracking type upgrade upnp user-manager users user vlan secret vrrp watchdog web-access wireless pptp pppoe lan wan layer7-protocol lease simple raw'; | ||
const OBJECTS = 'traffic-flow traffic-generator firewall scheduler aaa accounting address-list address align area bandwidth-server bfd bgp bridge client clock community config connection console customer default dhcp-client dhcp-server discovery dns e-mail ethernet filter firmware gps graphing group hardware health hotspot identity igmp-proxy incoming instance interface ip ipsec ipv6 irq l2tp-server lcd ldp logging mac-server mac-winbox mangle manual mirror mme mpls nat nd neighbor network note ntp ospf ospf-v3 ovpn-server page peer pim ping policy pool port ppp pppoe-client pptp-server prefix profile proposal proxy queue radius resource rip ripng route routing screen script security-profiles server service service-port settings shares smb sms sniffer snmp snooper socks sstp-server system tool tracking type upgrade upnp user-manager users user vlan secret vrrp watchdog web-access wireless pptp pppoe lan wan layer7-protocol lease simple raw'; | ||
@@ -28,0 +28,0 @@ const VAR = { |
@@ -106,3 +106,3 @@ /** | ||
{ // heredocs | ||
begin: /<<[-~]?'?(\w+)(?:.|\n)*?\n\s*\1\b/, | ||
begin: /<<[-~]?'?(\w+)\n(?:[^\n]*\n)*?\s*\1\b/, | ||
returnBegin: true, | ||
@@ -236,3 +236,3 @@ contains: [ | ||
var DEFAULT_PROMPT = "[\\w#]+\\(\\w+\\):\\d+:\\d+>"; | ||
var RVM_PROMPT = "(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>"; | ||
var RVM_PROMPT = "(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"; | ||
@@ -239,0 +239,0 @@ var IRB_DEFAULT = [ |
@@ -66,3 +66,3 @@ /* | ||
{ // looks like #-comment | ||
begin: '#\\s+[a-zA-Z .]*', | ||
begin: '#\\s+', | ||
relevance: 0 | ||
@@ -69,0 +69,0 @@ }, |
@@ -56,5 +56,6 @@ /* | ||
}, | ||
// seems to be a guard against [ident]' or [ident]. | ||
// perhaps to prevent attributes from flagging as keywords? | ||
{ | ||
begin: '[a-zA-Z_][a-zA-Z_0-9]*(\'+[\\.\']*|[\\.\']+)', | ||
end: '', | ||
begin: '[a-zA-Z_][a-zA-Z_0-9]*[\\.\']+', | ||
relevance: 0 | ||
@@ -64,3 +65,3 @@ }, | ||
begin: '\\[', | ||
end: '\\]\'*[\\.\']*', | ||
end: '\\][\\.\']*', | ||
relevance: 0, | ||
@@ -67,0 +68,0 @@ contains: COMMON_CONTAINS |
@@ -14,3 +14,3 @@ /* | ||
className: 'variable', | ||
begin: /\b_+[a-zA-Z_]\w*/ | ||
begin: /\b_+[a-zA-Z]\w*/ | ||
}; | ||
@@ -17,0 +17,0 @@ |
@@ -453,4 +453,4 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; | ||
'[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\)[^()]*)*' + | ||
'\\)[^()]*)*' + | ||
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>', | ||
@@ -545,4 +545,4 @@ returnBegin: true, | ||
'[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\))*[^()]*' + | ||
'\\)[^()]*)*' + | ||
'\\)[^()]*)*' + | ||
'\\)\\s*\\{', // end parens | ||
@@ -549,0 +549,0 @@ returnBegin:true, |
@@ -90,3 +90,3 @@ /* | ||
begin: '\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|' + | ||
'(0[Xx])?[0-9][0-9_]*\\.?[0-9_]*(?:[pP](?:[+-]?[0-9_]+)?)?)\\b', | ||
'(0[Xx])?[0-9][0-9_]*(\\.[0-9_]*)?(?:[pP](?:[+-]?[0-9_]+)?)?)\\b', | ||
relevance: 0 | ||
@@ -93,0 +93,0 @@ }, |
@@ -152,3 +152,3 @@ /* | ||
const DIRECT = { | ||
begin: /<([\w\._:\-]+)((\s*.*)=('|").*('|"))?>/, | ||
begin: /<([\w\._:\-]+)(\s+\S*=('|").*('|"))?>/, | ||
end: /(\/[\w\._:\-]+>)/, | ||
@@ -155,0 +155,0 @@ subLanguage: 'xml', |
@@ -105,3 +105,3 @@ /* | ||
className: 'string', | ||
begin: '[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^\\n]+\\n(\\2[^\\n]+\\n?)*' | ||
begin: '[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*' | ||
}, | ||
@@ -108,0 +108,0 @@ { // Ruby/Rails erb |
@@ -9,3 +9,3 @@ { | ||
"homepage": "https://highlightjs.org/", | ||
"version": "10.4.0", | ||
"version": "10.4.1", | ||
"author": { | ||
@@ -1241,2 +1241,3 @@ "name": "Ivan Sagalaev", | ||
"mocha": "^8.2.1", | ||
"refa": "^0.4.1", | ||
"rollup": "^2.33.1", | ||
@@ -1243,0 +1244,0 @@ "should": "^13.2.3", |
@@ -247,7 +247,7 @@ # Highlight.js | ||
<link rel="stylesheet" | ||
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/styles/default.min.css"> | ||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/highlight.min.js"></script> | ||
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/styles/default.min.css"> | ||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/highlight.min.js"></script> | ||
<!-- and it's easy to individually load additional languages --> | ||
<script charset="UTF-8" | ||
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/languages/go.min.js"></script> | ||
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/languages/go.min.js"></script> | ||
``` | ||
@@ -259,4 +259,4 @@ | ||
<link rel="stylesheet" | ||
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.4.0/build/styles/default.min.css"> | ||
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.4.0/build/highlight.min.js"></script> | ||
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.4.1/build/styles/default.min.css"> | ||
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.4.1/build/highlight.min.js"></script> | ||
``` | ||
@@ -267,4 +267,4 @@ | ||
```html | ||
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@10.4.0/styles/default.min.css"> | ||
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.4.0/highlight.min.js"></script> | ||
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@10.4.1/styles/default.min.css"> | ||
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.4.1/highlight.min.js"></script> | ||
``` | ||
@@ -271,0 +271,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
1654273
46290
0
31