1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function haxe(hljs) {
|
10 |
|
11 | const HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array ';
|
12 |
|
13 | return {
|
14 | name: 'Haxe',
|
15 | aliases: ['hx'],
|
16 | keywords: {
|
17 | keyword: 'break case cast catch continue default do dynamic else enum extern ' +
|
18 | 'for function here if import in inline never new override package private get set ' +
|
19 | 'public return static super switch this throw trace try typedef untyped using var while ' +
|
20 | HAXE_BASIC_TYPES,
|
21 | built_in:
|
22 | 'trace this',
|
23 | literal:
|
24 | 'true false null _'
|
25 | },
|
26 | contains: [
|
27 | {
|
28 | className: 'string',
|
29 | begin: '\'',
|
30 | end: '\'',
|
31 | contains: [
|
32 | hljs.BACKSLASH_ESCAPE,
|
33 | {
|
34 | className: 'subst',
|
35 | begin: '\\$\\{',
|
36 | end: '\\}'
|
37 | },
|
38 | {
|
39 | className: 'subst',
|
40 | begin: '\\$',
|
41 | end: /\W\}/
|
42 | }
|
43 | ]
|
44 | },
|
45 | hljs.QUOTE_STRING_MODE,
|
46 | hljs.C_LINE_COMMENT_MODE,
|
47 | hljs.C_BLOCK_COMMENT_MODE,
|
48 | hljs.C_NUMBER_MODE,
|
49 | {
|
50 | className: 'meta',
|
51 | begin: '@:',
|
52 | end: '$'
|
53 | },
|
54 | {
|
55 | className: 'meta',
|
56 | begin: '#',
|
57 | end: '$',
|
58 | keywords: {
|
59 | keyword: 'if else elseif end error'
|
60 | }
|
61 | },
|
62 | {
|
63 | className: 'type',
|
64 | begin: ':[ \t]*',
|
65 | end: '[^A-Za-z0-9_ \t\\->]',
|
66 | excludeBegin: true,
|
67 | excludeEnd: true,
|
68 | relevance: 0
|
69 | },
|
70 | {
|
71 | className: 'type',
|
72 | begin: ':[ \t]*',
|
73 | end: '\\W',
|
74 | excludeBegin: true,
|
75 | excludeEnd: true
|
76 | },
|
77 | {
|
78 | className: 'type',
|
79 | begin: 'new *',
|
80 | end: '\\W',
|
81 | excludeBegin: true,
|
82 | excludeEnd: true
|
83 | },
|
84 | {
|
85 | className: 'class',
|
86 | beginKeywords: 'enum',
|
87 | end: '\\{',
|
88 | contains: [hljs.TITLE_MODE]
|
89 | },
|
90 | {
|
91 | className: 'class',
|
92 | beginKeywords: 'abstract',
|
93 | end: '[\\{$]',
|
94 | contains: [
|
95 | {
|
96 | className: 'type',
|
97 | begin: '\\(',
|
98 | end: '\\)',
|
99 | excludeBegin: true,
|
100 | excludeEnd: true
|
101 | },
|
102 | {
|
103 | className: 'type',
|
104 | begin: 'from +',
|
105 | end: '\\W',
|
106 | excludeBegin: true,
|
107 | excludeEnd: true
|
108 | },
|
109 | {
|
110 | className: 'type',
|
111 | begin: 'to +',
|
112 | end: '\\W',
|
113 | excludeBegin: true,
|
114 | excludeEnd: true
|
115 | },
|
116 | hljs.TITLE_MODE
|
117 | ],
|
118 | keywords: {
|
119 | keyword: 'abstract from to'
|
120 | }
|
121 | },
|
122 | {
|
123 | className: 'class',
|
124 | begin: '\\b(class|interface) +',
|
125 | end: '[\\{$]',
|
126 | excludeEnd: true,
|
127 | keywords: 'class interface',
|
128 | contains: [
|
129 | {
|
130 | className: 'keyword',
|
131 | begin: '\\b(extends|implements) +',
|
132 | keywords: 'extends implements',
|
133 | contains: [
|
134 | {
|
135 | className: 'type',
|
136 | begin: hljs.IDENT_RE,
|
137 | relevance: 0
|
138 | }
|
139 | ]
|
140 | },
|
141 | hljs.TITLE_MODE
|
142 | ]
|
143 | },
|
144 | {
|
145 | className: 'function',
|
146 | beginKeywords: 'function',
|
147 | end: '\\(',
|
148 | excludeEnd: true,
|
149 | illegal: '\\S',
|
150 | contains: [hljs.TITLE_MODE]
|
151 | }
|
152 | ],
|
153 | illegal: /<\//
|
154 | };
|
155 | }
|
156 |
|
157 | export { haxe as default };
|