-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathhighlight-effekt.js
More file actions
96 lines (86 loc) · 2.11 KB
/
highlight-effekt.js
File metadata and controls
96 lines (86 loc) · 2.11 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
ORIGINAL
=========
https://github.com/highlightjs/highlight.js/blob/master/src/languages/scala.js
=========
Language: Scala
Category: functional
Author: Jan Berkel <jan.berkel@gmail.com>
Contributors: Erik Osheim <d_m@plastic-idolatry.com>
Website: https://www.scala-lang.org
*/
hljs.registerLanguage("effekt", function highlightEffekt(hljs) {
var ANNOTATION = { className: 'meta', begin: '@[A-Za-z]+' };
// used in strings for escaping/interpolation/substitution
var SUBST = {
className: 'subst',
variants: [
{begin: '\\$[A-Za-z0-9_?!]+'},
{begin: '\\${', end: '}'}
]
};
var STRING = {
className: 'string',
variants: [
{
begin: '"', end: '"',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: '"""', end: '"""',
relevance: 10
},
{
begin: '[a-z]+"', end: '"',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
},
{
className: 'string',
begin: '[a-z]+"""', end: '"""',
contains: [SUBST],
relevance: 10
}
]
};
var SYMBOL = {
className: 'symbol',
begin: '\'\\w[\\w\\d_?!]*(?!\')'
};
var TYPE = {
className: 'type',
begin: '\\b[A-Z][A-Za-z0-9_?!]*',
relevance: 0
};
var NAME = {
className: 'title',
begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,
relevance: 0
};
var DEFINITION = {
className: 'function',
beginKeywords: 'def effect type val var extern fun interface resource namespace',
end: /[:={\[(\n;]/,
excludeEnd: true,
contains: [NAME]
};
return {
name: 'Effekt',
keywords: {
literal: 'true false',
keyword: 'module effect type def with val var if for while import return else case try match resume do record region in new interface let box unbox fun extern and is namespace'
},
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
STRING,
SYMBOL,
TYPE,
DEFINITION,
hljs.C_NUMBER_MODE,
ANNOTATION
]
};
})
module.exports = hljs