summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-rust.min.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-30 19:47:21 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-30 19:47:21 +0100
commita98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch)
tree542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-rust.min.js
parentab355897a12b7bda1089a44de326d41455a0f7a3 (diff)
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-rust.min.js')
-rw-r--r--public/prism/prism-rust.min.js89
1 files changed, 89 insertions, 0 deletions
diff --git a/public/prism/prism-rust.min.js b/public/prism/prism-rust.min.js
new file mode 100644
index 0000000..cdd6ef6
--- /dev/null
+++ b/public/prism/prism-rust.min.js
@@ -0,0 +1,89 @@
+!(function (e) {
+ for (var a = '/\\*(?:[^*/]|\\*(?!/)|/(?!\\*)|<self>)*\\*/', t = 0; t < 2; t++)
+ a = a.replace(/<self>/g, function () {
+ return a;
+ });
+ (a = a.replace(/<self>/g, function () {
+ return '[^\\s\\S]';
+ })),
+ (e.languages.rust = {
+ comment: [
+ { pattern: RegExp('(^|[^\\\\])' + a), lookbehind: !0, greedy: !0 },
+ { pattern: /(^|[^\\:])\/\/.*/, lookbehind: !0, greedy: !0 },
+ ],
+ string: {
+ pattern: /b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,
+ greedy: !0,
+ },
+ char: {
+ pattern:
+ /b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,
+ greedy: !0,
+ },
+ attribute: {
+ pattern: /#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,
+ greedy: !0,
+ alias: 'attr-name',
+ inside: { string: null },
+ },
+ 'closure-params': {
+ pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,
+ lookbehind: !0,
+ greedy: !0,
+ inside: {
+ 'closure-punctuation': { pattern: /^\||\|$/, alias: 'punctuation' },
+ rest: null,
+ },
+ },
+ 'lifetime-annotation': { pattern: /'\w+/, alias: 'symbol' },
+ 'fragment-specifier': {
+ pattern: /(\$\w+:)[a-z]+/,
+ lookbehind: !0,
+ alias: 'punctuation',
+ },
+ variable: /\$\w+/,
+ 'function-definition': {
+ pattern: /(\bfn\s+)\w+/,
+ lookbehind: !0,
+ alias: 'function',
+ },
+ 'type-definition': {
+ pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
+ lookbehind: !0,
+ alias: 'class-name',
+ },
+ 'module-declaration': [
+ {
+ pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
+ lookbehind: !0,
+ alias: 'namespace',
+ },
+ {
+ pattern:
+ /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
+ lookbehind: !0,
+ alias: 'namespace',
+ inside: { punctuation: /::/ },
+ },
+ ],
+ keyword: [
+ /\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,
+ /\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/,
+ ],
+ function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
+ macro: { pattern: /\b\w+!/, alias: 'property' },
+ constant: /\b[A-Z_][A-Z_\d]+\b/,
+ 'class-name': /\b[A-Z]\w*\b/,
+ namespace: {
+ pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
+ inside: { punctuation: /::/ },
+ },
+ number:
+ /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,
+ boolean: /\b(?:false|true)\b/,
+ punctuation: /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,
+ operator: /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/,
+ }),
+ (e.languages.rust['closure-params'].inside.rest = e.languages.rust),
+ (e.languages.rust.attribute.inside.string = e.languages.rust.string);
+})(Prism);