main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
2.0 KB
|
Line | |
---|
1 | /*
|
---|
2 | Language: Ceylon
|
---|
3 | Author: Lucas Werkmeister <mail@lucaswerkmeister.de>
|
---|
4 | Website: https://ceylon-lang.org
|
---|
5 | */
|
---|
6 |
|
---|
7 | /** @type LanguageFn */
|
---|
8 | function ceylon(hljs) {
|
---|
9 | // 2.3. Identifiers and keywords
|
---|
10 | const KEYWORDS =
|
---|
11 | 'assembly module package import alias class interface object given value ' +
|
---|
12 | 'assign void function new of extends satisfies abstracts in out return ' +
|
---|
13 | 'break continue throw assert dynamic if else switch case for while try ' +
|
---|
14 | 'catch finally then let this outer super is exists nonempty';
|
---|
15 | // 7.4.1 Declaration Modifiers
|
---|
16 | const DECLARATION_MODIFIERS =
|
---|
17 | 'shared abstract formal default actual variable late native deprecated ' +
|
---|
18 | 'final sealed annotation suppressWarnings small';
|
---|
19 | // 7.4.2 Documentation
|
---|
20 | const DOCUMENTATION =
|
---|
21 | 'doc by license see throws tagged';
|
---|
22 | const SUBST = {
|
---|
23 | className: 'subst',
|
---|
24 | excludeBegin: true,
|
---|
25 | excludeEnd: true,
|
---|
26 | begin: /``/,
|
---|
27 | end: /``/,
|
---|
28 | keywords: KEYWORDS,
|
---|
29 | relevance: 10
|
---|
30 | };
|
---|
31 | const EXPRESSIONS = [
|
---|
32 | {
|
---|
33 | // verbatim string
|
---|
34 | className: 'string',
|
---|
35 | begin: '"""',
|
---|
36 | end: '"""',
|
---|
37 | relevance: 10
|
---|
38 | },
|
---|
39 | {
|
---|
40 | // string literal or template
|
---|
41 | className: 'string',
|
---|
42 | begin: '"',
|
---|
43 | end: '"',
|
---|
44 | contains: [SUBST]
|
---|
45 | },
|
---|
46 | {
|
---|
47 | // character literal
|
---|
48 | className: 'string',
|
---|
49 | begin: "'",
|
---|
50 | end: "'"
|
---|
51 | },
|
---|
52 | {
|
---|
53 | // numeric literal
|
---|
54 | className: 'number',
|
---|
55 | begin: '#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?',
|
---|
56 | relevance: 0
|
---|
57 | }
|
---|
58 | ];
|
---|
59 | SUBST.contains = EXPRESSIONS;
|
---|
60 |
|
---|
61 | return {
|
---|
62 | name: 'Ceylon',
|
---|
63 | keywords: {
|
---|
64 | keyword: KEYWORDS + ' ' + DECLARATION_MODIFIERS,
|
---|
65 | meta: DOCUMENTATION
|
---|
66 | },
|
---|
67 | illegal: '\\$[^01]|#[^0-9a-fA-F]',
|
---|
68 | contains: [
|
---|
69 | hljs.C_LINE_COMMENT_MODE,
|
---|
70 | hljs.COMMENT('/\\*', '\\*/', {
|
---|
71 | contains: ['self']
|
---|
72 | }),
|
---|
73 | {
|
---|
74 | // compiler annotation
|
---|
75 | className: 'meta',
|
---|
76 | begin: '@[a-z]\\w*(?::"[^"]*")?'
|
---|
77 | }
|
---|
78 | ].concat(EXPRESSIONS)
|
---|
79 | };
|
---|
80 | }
|
---|
81 |
|
---|
82 | module.exports = ceylon;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.