-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
bqn.js
71 lines (70 loc) · 1.86 KB
/
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
66
67
68
69
70
71
// @ts-nocheck
bqn.displayName = 'bqn'
bqn.aliases = []
/** @type {import('../core.js').Syntax} */
export default function bqn(Prism) {
Prism.languages.bqn = {
shebang: {
pattern: /^#![ \t]*\/.*/,
alias: 'important',
greedy: true
},
comment: {
pattern: /#.*/,
greedy: true
},
'string-literal': {
pattern: /"(?:[^"]|"")*"/,
greedy: true,
alias: 'string'
},
'character-literal': {
pattern: /'(?:[\s\S]|[\uD800-\uDBFF][\uDC00-\uDFFF])'/,
greedy: true,
alias: 'char'
},
function: /•[\w¯.∞π]+[\w¯.∞π]*/,
'dot-notation-on-brackets': {
pattern: /\{(?=.*\}\.)|\}\./,
alias: 'namespace'
},
'special-name': {
pattern: /(?:𝕨|𝕩|𝕗|𝕘|𝕤|𝕣|𝕎|𝕏|𝔽|𝔾|𝕊|_𝕣_|_𝕣)/,
alias: 'keyword'
},
'dot-notation-on-name': {
pattern: /[A-Za-z_][\w¯∞π]*\./,
alias: 'namespace'
},
'word-number-scientific': {
pattern: /\d+(?:\.\d+)?[eE]¯?\d+/,
alias: 'number'
},
'word-name': {
pattern: /[A-Za-z_][\w¯∞π]*/,
alias: 'symbol'
},
'word-number': {
pattern:
/[¯∞π]?(?:\d*\.?\b\d+(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π))?/,
alias: 'number'
},
'null-literal': {
pattern: /@/,
alias: 'char'
},
'primitive-functions': {
pattern: /[-+×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!]/,
alias: 'operator'
},
'primitive-1-operators': {
pattern: /[`˜˘¨⁼⌜´˝˙]/,
alias: 'operator'
},
'primitive-2-operators': {
pattern: /[∘⊸⟜○⌾⎉⚇⍟⊘◶⎊]/,
alias: 'operator'
},
punctuation: /[←⇐↩(){}⟨⟩[\]‿·⋄,.;:?]/
}
}