aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-tremor.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-tremor.js
parentab355897a12b7bda1089a44de326d41455a0f7a3 (diff)
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-tremor.js')
-rw-r--r--public/prism/prism-tremor.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/public/prism/prism-tremor.js b/public/prism/prism-tremor.js
new file mode 100644
index 0000000..9833ee4
--- /dev/null
+++ b/public/prism/prism-tremor.js
@@ -0,0 +1,82 @@
+(function (Prism) {
+ Prism.languages.tremor = {
+ comment: {
+ pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
+ lookbehind: true,
+ },
+ 'interpolated-string': null, // see below
+ extractor: {
+ pattern: /\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i,
+ greedy: true,
+ inside: {
+ regex: {
+ pattern: /(^re)\|[\s\S]+/,
+ lookbehind: true,
+ },
+ function: /^\w+/,
+ value: /\|[\s\S]+/,
+ },
+ },
+ identifier: {
+ pattern: /`[^`]*`/,
+ greedy: true,
+ },
+
+ function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,
+
+ keyword:
+ /\b(?:args|as|by|case|config|connect|connector|const|copy|create|default|define|deploy|drop|each|emit|end|erase|event|flow|fn|for|from|group|having|insert|into|intrinsic|let|links|match|merge|mod|move|of|operator|patch|pipeline|recur|script|select|set|sliding|state|stream|to|tumbling|update|use|when|where|window|with)\b/,
+ boolean: /\b(?:false|null|true)\b/i,
+
+ number:
+ /\b(?:0b[01_]*|0x[0-9a-fA-F_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee][+-]?[\d_]+)?)\b/,
+
+ 'pattern-punctuation': {
+ pattern: /%(?=[({[])/,
+ alias: 'punctuation',
+ },
+ operator:
+ /[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?>?=?|(?:absent|and|not|or|present|xor)\b/,
+ punctuation: /::|[;\[\]()\{\},.:]/,
+ };
+
+ var interpolationPattern =
+ /#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*")*\}/.source;
+
+ Prism.languages.tremor['interpolated-string'] = {
+ pattern: RegExp(
+ /(^|[^\\])/.source +
+ '(?:' +
+ '"""(?:' +
+ /[^"\\#]|\\[\s\S]|"(?!"")|#(?!\{)/.source +
+ '|' +
+ interpolationPattern +
+ ')*"""' +
+ '|' +
+ '"(?:' +
+ /[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)/.source +
+ '|' +
+ interpolationPattern +
+ ')*"' +
+ ')'
+ ),
+ lookbehind: true,
+ greedy: true,
+ inside: {
+ interpolation: {
+ pattern: RegExp(interpolationPattern),
+ inside: {
+ punctuation: /^#\{|\}$/,
+ expression: {
+ pattern: /[\s\S]+/,
+ inside: Prism.languages.tremor,
+ },
+ },
+ },
+ string: /[\s\S]+/,
+ },
+ };
+
+ Prism.languages.troy = Prism.languages['tremor'];
+ Prism.languages.trickle = Prism.languages['tremor'];
+})(Prism);