UNPKG

1.29 kBJavaScriptView Raw
1/*
2 Language: Flix
3 Category: functional
4 Author: Magnus Madsen <mmadsen@uwaterloo.ca>
5 Website: https://flix.dev/
6 */
7
8 /** @type LanguageFn */
9function flix(hljs) {
10 const CHAR = {
11 className: 'string',
12 begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/
13 };
14
15 const STRING = {
16 className: 'string',
17 variants: [{
18 begin: '"',
19 end: '"'
20 }]
21 };
22
23 const NAME = {
24 className: 'title',
25 relevance: 0,
26 begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/
27 };
28
29 const METHOD = {
30 className: 'function',
31 beginKeywords: 'def',
32 end: /[:={\[(\n;]/,
33 excludeEnd: true,
34 contains: [NAME]
35 };
36
37 return {
38 name: 'Flix',
39 keywords: {
40 keyword: [
41 "case",
42 "class",
43 "def",
44 "else",
45 "enum",
46 "if",
47 "impl",
48 "import",
49 "in",
50 "lat",
51 "rel",
52 "index",
53 "let",
54 "match",
55 "namespace",
56 "switch",
57 "type",
58 "yield",
59 "with"
60 ],
61 literal: [
62 "true",
63 "false"
64 ]
65 },
66 contains: [
67 hljs.C_LINE_COMMENT_MODE,
68 hljs.C_BLOCK_COMMENT_MODE,
69 CHAR,
70 STRING,
71 METHOD,
72 hljs.C_NUMBER_MODE
73 ]
74 };
75}
76
77export { flix as default };