1 | (function (Prism) {
|
---|
2 |
|
---|
3 | Prism.languages.tremor = {
|
---|
4 | 'comment': {
|
---|
5 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
|
---|
6 | lookbehind: true
|
---|
7 | },
|
---|
8 | 'interpolated-string': null, // see below
|
---|
9 | 'extractor': {
|
---|
10 | pattern: /\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i,
|
---|
11 | greedy: true,
|
---|
12 | inside: {
|
---|
13 | 'regex': {
|
---|
14 | pattern: /(^re)\|[\s\S]+/,
|
---|
15 | lookbehind: true
|
---|
16 | },
|
---|
17 | 'function': /^\w+/,
|
---|
18 | 'value': /\|[\s\S]+/
|
---|
19 | }
|
---|
20 | },
|
---|
21 | 'identifier': {
|
---|
22 | pattern: /`[^`]*`/,
|
---|
23 | greedy: true
|
---|
24 | },
|
---|
25 |
|
---|
26 | 'function': /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,
|
---|
27 |
|
---|
28 | '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/,
|
---|
29 | 'boolean': /\b(?:false|null|true)\b/i,
|
---|
30 |
|
---|
31 | 'number': /\b(?:0b[01_]*|0x[0-9a-fA-F_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee][+-]?[\d_]+)?)\b/,
|
---|
32 |
|
---|
33 | 'pattern-punctuation': {
|
---|
34 | pattern: /%(?=[({[])/,
|
---|
35 | alias: 'punctuation'
|
---|
36 | },
|
---|
37 | 'operator': /[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?>?=?|(?:absent|and|not|or|present|xor)\b/,
|
---|
38 | 'punctuation': /::|[;\[\]()\{\},.:]/,
|
---|
39 | };
|
---|
40 |
|
---|
41 | var interpolationPattern = /#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*")*\}/.source;
|
---|
42 |
|
---|
43 | Prism.languages.tremor['interpolated-string'] = {
|
---|
44 | pattern: RegExp(
|
---|
45 | /(^|[^\\])/.source +
|
---|
46 | '(?:' +
|
---|
47 | '"""(?:' + /[^"\\#]|\\[\s\S]|"(?!"")|#(?!\{)/.source + '|' + interpolationPattern + ')*"""' +
|
---|
48 | '|' +
|
---|
49 | '"(?:' + /[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)/.source + '|' + interpolationPattern + ')*"' +
|
---|
50 | ')'
|
---|
51 | ),
|
---|
52 | lookbehind: true,
|
---|
53 | greedy: true,
|
---|
54 | inside: {
|
---|
55 | 'interpolation': {
|
---|
56 | pattern: RegExp(interpolationPattern),
|
---|
57 | inside: {
|
---|
58 | 'punctuation': /^#\{|\}$/,
|
---|
59 | 'expression': {
|
---|
60 | pattern: /[\s\S]+/,
|
---|
61 | inside: Prism.languages.tremor
|
---|
62 | }
|
---|
63 | }
|
---|
64 | },
|
---|
65 | 'string': /[\s\S]+/
|
---|
66 | }
|
---|
67 | };
|
---|
68 |
|
---|
69 | Prism.languages.troy = Prism.languages['tremor'];
|
---|
70 | Prism.languages.trickle = Prism.languages['tremor'];
|
---|
71 |
|
---|
72 | }(Prism));
|
---|