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

102 lines
3.1 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: Oxygene
Author: Carlo Kok <ck@remobjects.com>
Description: Oxygene is built on the foundation of Object Pascal, revamped and extended to be a modern language for the twenty-first century.
Website: https://www.elementscompiler.com/elements/default.aspx
*/
function oxygene(hljs) {
const OXYGENE_KEYWORDS = {
$pattern: /\.?\w+/,
keyword:
'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue ' +
'create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false ' +
'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited ' +
'inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of ' +
'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly ' +
'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple ' +
'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal ' +
'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained'
};
const CURLY_COMMENT = hljs.COMMENT(
/\{/,
/\}/,
2023-12-18 13:12:25 +08:00
{
relevance: 0
}
);
2024-01-16 21:26:16 +08:00
const PAREN_COMMENT = hljs.COMMENT(
2023-12-18 13:12:25 +08:00
'\\(\\*',
'\\*\\)',
{
relevance: 10
}
);
2024-01-16 21:26:16 +08:00
const STRING = {
2023-12-18 13:12:25 +08:00
className: 'string',
2024-01-16 21:26:16 +08:00
begin: '\'',
end: '\'',
contains: [
{
begin: '\'\''
}
]
2023-12-18 13:12:25 +08:00
};
2024-01-16 21:26:16 +08:00
const CHAR_STRING = {
className: 'string',
begin: '(#\\d+)+'
2023-12-18 13:12:25 +08:00
};
2024-01-16 21:26:16 +08:00
const FUNCTION = {
2023-12-18 13:12:25 +08:00
className: 'function',
2024-01-16 21:26:16 +08:00
beginKeywords: 'function constructor destructor procedure method',
end: '[:;]',
2023-12-18 13:12:25 +08:00
keywords: 'function constructor|10 destructor|10 procedure|10 method|10',
contains: [
hljs.TITLE_MODE,
{
className: 'params',
2024-01-16 21:26:16 +08:00
begin: '\\(',
end: '\\)',
2023-12-18 13:12:25 +08:00
keywords: OXYGENE_KEYWORDS,
2024-01-16 21:26:16 +08:00
contains: [
STRING,
CHAR_STRING
]
2023-12-18 13:12:25 +08:00
},
2024-01-16 21:26:16 +08:00
CURLY_COMMENT,
PAREN_COMMENT
2023-12-18 13:12:25 +08:00
]
};
return {
2024-01-16 21:26:16 +08:00
name: 'Oxygene',
2023-12-18 13:12:25 +08:00
case_insensitive: true,
keywords: OXYGENE_KEYWORDS,
illegal: '("|\\$[G-Zg-z]|\\/\\*|</|=>|->)',
contains: [
2024-01-16 21:26:16 +08:00
CURLY_COMMENT,
PAREN_COMMENT,
hljs.C_LINE_COMMENT_MODE,
STRING,
CHAR_STRING,
2023-12-18 13:12:25 +08:00
hljs.NUMBER_MODE,
FUNCTION,
{
className: 'class',
2024-01-16 21:26:16 +08:00
begin: '=\\bclass\\b',
end: 'end;',
2023-12-18 13:12:25 +08:00
keywords: OXYGENE_KEYWORDS,
contains: [
2024-01-16 21:26:16 +08:00
STRING,
CHAR_STRING,
CURLY_COMMENT,
PAREN_COMMENT,
hljs.C_LINE_COMMENT_MODE,
2023-12-18 13:12:25 +08:00
FUNCTION
]
}
]
};
2024-01-16 21:26:16 +08:00
}
module.exports = oxygene;