1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | function ceylon(hljs) {
|
9 |
|
10 | const KEYWORDS = [
|
11 | "assembly",
|
12 | "module",
|
13 | "package",
|
14 | "import",
|
15 | "alias",
|
16 | "class",
|
17 | "interface",
|
18 | "object",
|
19 | "given",
|
20 | "value",
|
21 | "assign",
|
22 | "void",
|
23 | "function",
|
24 | "new",
|
25 | "of",
|
26 | "extends",
|
27 | "satisfies",
|
28 | "abstracts",
|
29 | "in",
|
30 | "out",
|
31 | "return",
|
32 | "break",
|
33 | "continue",
|
34 | "throw",
|
35 | "assert",
|
36 | "dynamic",
|
37 | "if",
|
38 | "else",
|
39 | "switch",
|
40 | "case",
|
41 | "for",
|
42 | "while",
|
43 | "try",
|
44 | "catch",
|
45 | "finally",
|
46 | "then",
|
47 | "let",
|
48 | "this",
|
49 | "outer",
|
50 | "super",
|
51 | "is",
|
52 | "exists",
|
53 | "nonempty"
|
54 | ];
|
55 |
|
56 | const DECLARATION_MODIFIERS = [
|
57 | "shared",
|
58 | "abstract",
|
59 | "formal",
|
60 | "default",
|
61 | "actual",
|
62 | "variable",
|
63 | "late",
|
64 | "native",
|
65 | "deprecated",
|
66 | "final",
|
67 | "sealed",
|
68 | "annotation",
|
69 | "suppressWarnings",
|
70 | "small"
|
71 | ];
|
72 |
|
73 | const DOCUMENTATION = [
|
74 | "doc",
|
75 | "by",
|
76 | "license",
|
77 | "see",
|
78 | "throws",
|
79 | "tagged"
|
80 | ];
|
81 | const SUBST = {
|
82 | className: 'subst',
|
83 | excludeBegin: true,
|
84 | excludeEnd: true,
|
85 | begin: /``/,
|
86 | end: /``/,
|
87 | keywords: KEYWORDS,
|
88 | relevance: 10
|
89 | };
|
90 | const EXPRESSIONS = [
|
91 | {
|
92 |
|
93 | className: 'string',
|
94 | begin: '"""',
|
95 | end: '"""',
|
96 | relevance: 10
|
97 | },
|
98 | {
|
99 |
|
100 | className: 'string',
|
101 | begin: '"',
|
102 | end: '"',
|
103 | contains: [SUBST]
|
104 | },
|
105 | {
|
106 |
|
107 | className: 'string',
|
108 | begin: "'",
|
109 | end: "'"
|
110 | },
|
111 | {
|
112 |
|
113 | className: 'number',
|
114 | begin: '#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?',
|
115 | relevance: 0
|
116 | }
|
117 | ];
|
118 | SUBST.contains = EXPRESSIONS;
|
119 |
|
120 | return {
|
121 | name: 'Ceylon',
|
122 | keywords: {
|
123 | keyword: KEYWORDS.concat(DECLARATION_MODIFIERS),
|
124 | meta: DOCUMENTATION
|
125 | },
|
126 | illegal: '\\$[^01]|#[^0-9a-fA-F]',
|
127 | contains: [
|
128 | hljs.C_LINE_COMMENT_MODE,
|
129 | hljs.COMMENT('/\\*', '\\*/', {
|
130 | contains: ['self']
|
131 | }),
|
132 | {
|
133 |
|
134 | className: 'meta',
|
135 | begin: '@[a-z]\\w*(?::"[^"]*")?'
|
136 | }
|
137 | ].concat(EXPRESSIONS)
|
138 | };
|
139 | }
|
140 |
|
141 | export { ceylon as default };
|