source: node_modules/refractor/lang/tremor.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

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