|
|
@@ -1,4 +1,4 @@
|
|
|
-/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+erlang+go+java+json+kotlin+lua+nginx+perl+php+python+crystal+rust+scss+sql+typescript */
|
|
|
+/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+erlang+go+java+json+kotlin+lua+nginx+nim+perl+php+python+crystal+rust+scss+sql+typescript */
|
|
|
var _self = (typeof window !== 'undefined')
|
|
|
? window // if in browser
|
|
|
: (
|
|
|
@@ -568,6 +568,9 @@ Prism.languages.markup = {
|
|
|
'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) {
|
|
|
|
|
|
@@ -664,7 +667,7 @@ Prism.languages.clike = {
|
|
|
|
|
|
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-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
|
|
|
+ 'number': /\b-?(0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
|
|
|
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
|
'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,
|
|
|
'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
|
|
|
@@ -672,7 +675,7 @@ Prism.languages.javascript = Prism.languages.extend('clike', {
|
|
|
|
|
|
Prism.languages.insertBefore('javascript', 'keyword', {
|
|
|
'regex': {
|
|
|
- pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
|
|
|
+ pattern: /(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
|
|
|
lookbehind: true,
|
|
|
greedy: true
|
|
|
}
|
|
|
@@ -710,6 +713,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/,
|
|
|
'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,
|
|
|
@@ -1245,6 +1249,39 @@ Prism.languages.nginx = Prism.languages.extend('clike', {
|
|
|
Prism.languages.insertBefore('nginx', 'keyword', {
|
|
|
'variable': /\$[a-z_]+/i
|
|
|
});
|
|
|
+Prism.languages.nim = {
|
|
|
+ 'comment': /#.*/,
|
|
|
+ // Double-quoted strings can be prefixed by an identifier (Generalized raw string literals)
|
|
|
+ // Character literals are handled specifically to prevent issues with numeric type suffixes
|
|
|
+ 'string': {
|
|
|
+ pattern: /(?:(?:\b(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")|'(?:\\(?:\d+|x[\da-fA-F]{2}|.)|[^'])')/,
|
|
|
+ greedy: true
|
|
|
+ },
|
|
|
+ // The negative look ahead prevents wrong highlighting of the .. operator
|
|
|
+ 'number': /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/,
|
|
|
+ 'keyword': /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/,
|
|
|
+ 'function': {
|
|
|
+ pattern: /(?:(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/,
|
|
|
+ inside: {
|
|
|
+ 'operator': /\*$/
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // We don't want to highlight operators inside backticks
|
|
|
+ 'ignore': {
|
|
|
+ pattern: /`[^`\r\n]+`/,
|
|
|
+ inside: {
|
|
|
+ 'punctuation': /`/
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'operator': {
|
|
|
+ // Look behind and look ahead prevent wrong highlighting of punctuations [. .] {. .} (. .)
|
|
|
+ // but allow the slice operator .. to take precedence over them
|
|
|
+ // One can define his own operators in Nim so all combination of operators might be an operator.
|
|
|
+ pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|of|or|in|is|isnot|mod|not|notin|shl|shr|xor)\b)/m,
|
|
|
+ lookbehind: true
|
|
|
+ },
|
|
|
+ 'punctuation': /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/
|
|
|
+};
|
|
|
Prism.languages.perl = {
|
|
|
'comment': [
|
|
|
{
|