forked from PrismJS/prism
/
prism-bqn.js
65 lines (65 loc) · 1.5 KB
/
prism-bqn.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Prism.languages.bqn = {
'shebang': {
pattern: /^#![ \t]*\/.*/,
alias: 'important',
greedy: true
},
'comment': {
pattern: /#.*/,
greedy: true
},
'string-literal': {
pattern: /"(?:\\[\s\S]|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
greedy: true,
alias: 'string'
},
'character-literal': {
pattern: /'.'/,
greedy: true,
alias: 'string'
},
'function': {
pattern: /•[\w¯.∞π]+[\w¯.∞π]*/i
},
'dot-notation-on-brackets': {
pattern: /\{(?=.*\}\.)|\}\./,
alias: 'namespace'
},
'special-name': {
pattern: /(?:𝕨|𝕩|𝕗|𝕘|𝕤|𝕣|𝕎|𝕏|𝔽|𝔾|𝕊|_𝕣_|_𝕣)/,
alias: 'keyword'
},
'dot-notation-on-name': {
pattern: /[A-Z_][\w¯∞π]*\./i,
alias: 'namespace'
},
'word-number-scientific': {
pattern: /\d+(?:\.\d+)?[e|E]¯?\d+/,
alias: 'number'
},
'word-name': {
pattern: /[A-Z_][\w¯∞π]*/i,
alias: 'symbol'
},
'word-number': {
pattern: /[¯∞π]?(?:\d*\.?\b\d+(?:e[+¯]?\d+)?|¯|∞|π)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+)?|¯|∞|π))?/i,
alias: 'number'
},
'null-literal': {
pattern: /@/,
alias: 'string'
},
'primitive-functions': {
pattern: /[-+×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!]/,
alias: 'operator'
},
'primitive-1-operators': {
pattern: /[`˜˘¨⁼⌜´˝˙]/,
alias: 'operator'
},
'primitive-2-operators': {
pattern: /[∘⊸⟜○⌾⎉⚇⍟⊘◶⎊]/,
alias: 'operator'
},
'punctuation': /[←⇐↩(){}⟨⟩[\]‿·⋄,.;:?]/
};