1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/highlight.js/lib/languages/haxe.js

158 lines
3.9 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: Haxe
Description: Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.
Author: Christopher Kaster <ikasoki@gmail.com> (Based on the actionscript.js language file by Alexander Myadzel)
Contributors: Kenton Hamaluik <kentonh@gmail.com>
Website: https://haxe.org
*/
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
function haxe(hljs) {
const HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array ';
2023-12-18 13:12:25 +08:00
return {
2024-01-16 21:26:16 +08:00
name: 'Haxe',
2023-12-18 13:12:25 +08:00
aliases: ['hx'],
keywords: {
keyword: 'break case cast catch continue default do dynamic else enum extern ' +
'for function here if import in inline never new override package private get set ' +
'public return static super switch this throw trace try typedef untyped using var while ' +
HAXE_BASIC_TYPES,
built_in:
'trace this',
literal:
'true false null _'
},
contains: [
2024-01-16 21:26:16 +08:00
{
className: 'string', // interpolate-able strings
begin: '\'',
end: '\'',
2023-12-18 13:12:25 +08:00
contains: [
hljs.BACKSLASH_ESCAPE,
2024-01-16 21:26:16 +08:00
{
className: 'subst', // interpolation
begin: '\\$\\{',
end: '\\}'
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'subst', // interpolation
begin: '\\$',
end: /\W\}/
2023-12-18 13:12:25 +08:00
}
]
},
hljs.QUOTE_STRING_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.C_NUMBER_MODE,
2024-01-16 21:26:16 +08:00
{
className: 'meta', // compiler meta
begin: '@:',
end: '$'
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'meta', // compiler conditionals
begin: '#',
end: '$',
keywords: {
'meta-keyword': 'if else elseif end error'
}
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'type', // function types
begin: ':[ \t]*',
end: '[^A-Za-z0-9_ \t\\->]',
excludeBegin: true,
excludeEnd: true,
2023-12-18 13:12:25 +08:00
relevance: 0
},
2024-01-16 21:26:16 +08:00
{
className: 'type', // types
begin: ':[ \t]*',
end: '\\W',
excludeBegin: true,
excludeEnd: true
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'type', // instantiation
begin: 'new *',
end: '\\W',
excludeBegin: true,
excludeEnd: true
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'class', // enums
beginKeywords: 'enum',
end: '\\{',
contains: [hljs.TITLE_MODE]
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'class', // abstracts
beginKeywords: 'abstract',
end: '[\\{$]',
2023-12-18 13:12:25 +08:00
contains: [
2024-01-16 21:26:16 +08:00
{
className: 'type',
begin: '\\(',
end: '\\)',
excludeBegin: true,
excludeEnd: true
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'type',
begin: 'from +',
end: '\\W',
excludeBegin: true,
excludeEnd: true
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
{
className: 'type',
begin: 'to +',
end: '\\W',
excludeBegin: true,
excludeEnd: true
2023-12-18 13:12:25 +08:00
},
hljs.TITLE_MODE
],
keywords: {
keyword: 'abstract from to'
}
},
2024-01-16 21:26:16 +08:00
{
className: 'class', // classes
begin: '\\b(class|interface) +',
end: '[\\{$]',
excludeEnd: true,
2023-12-18 13:12:25 +08:00
keywords: 'class interface',
contains: [
2024-01-16 21:26:16 +08:00
{
className: 'keyword',
2023-12-18 13:12:25 +08:00
begin: '\\b(extends|implements) +',
keywords: 'extends implements',
contains: [
{
className: 'type',
begin: hljs.IDENT_RE,
relevance: 0
}
]
},
hljs.TITLE_MODE
]
},
2024-01-16 21:26:16 +08:00
{
className: 'function',
beginKeywords: 'function',
end: '\\(',
excludeEnd: true,
2023-12-18 13:12:25 +08:00
illegal: '\\S',
2024-01-16 21:26:16 +08:00
contains: [hljs.TITLE_MODE]
2023-12-18 13:12:25 +08:00
}
],
illegal: /<\//
};
2024-01-16 21:26:16 +08:00
}
module.exports = haxe;