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