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

103 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: crmsh
Author: Kristoffer Gronlund <kgronlund@suse.com>
Website: http://crmsh.github.io
Description: Syntax Highlighting for the crmsh DSL
Category: config
*/
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
/** @type LanguageFn */
function crmsh(hljs) {
const RESOURCES = 'primitive rsc_template';
const COMMANDS = 'group clone ms master location colocation order fencing_topology ' +
2023-12-18 13:12:25 +08:00
'rsc_ticket acl_target acl_group user role ' +
'tag xml';
2024-01-16 21:26:16 +08:00
const PROPERTY_SETS = 'property rsc_defaults op_defaults';
const KEYWORDS = 'params meta operations op rule attributes utilization';
const OPERATORS = 'read write deny defined not_defined in_range date spec in ' +
2023-12-18 13:12:25 +08:00
'ref reference attribute type xpath version and or lt gt tag ' +
'lte gte eq ne \\';
2024-01-16 21:26:16 +08:00
const TYPES = 'number string';
const LITERALS = 'Master Started Slave Stopped start promote demote stop monitor true false';
2023-12-18 13:12:25 +08:00
return {
2024-01-16 21:26:16 +08:00
name: 'crmsh',
aliases: [
'crm',
'pcmk'
],
2023-12-18 13:12:25 +08:00
case_insensitive: true,
keywords: {
keyword: KEYWORDS + ' ' + OPERATORS + ' ' + TYPES,
literal: LITERALS
},
contains: [
hljs.HASH_COMMENT_MODE,
{
beginKeywords: 'node',
starts: {
end: '\\s*([\\w_-]+:)?',
starts: {
className: 'title',
end: '\\s*[\\$\\w_][\\w_-]*'
}
}
},
{
beginKeywords: RESOURCES,
starts: {
className: 'title',
end: '\\s*[\\$\\w_][\\w_-]*',
starts: {
end: '\\s*@?[\\w_][\\w_\\.:-]*'
}
}
},
{
begin: '\\b(' + COMMANDS.split(' ').join('|') + ')\\s+',
keywords: COMMANDS,
starts: {
className: 'title',
end: '[\\$\\w_][\\w_-]*'
}
},
{
beginKeywords: PROPERTY_SETS,
starts: {
className: 'title',
end: '\\s*([\\w_-]+:)?'
}
},
hljs.QUOTE_STRING_MODE,
{
className: 'meta',
begin: '(ocf|systemd|service|lsb):[\\w_:-]+',
relevance: 0
},
{
className: 'number',
begin: '\\b\\d+(\\.\\d+)?(ms|s|h|m)?',
relevance: 0
},
{
className: 'literal',
begin: '[-]?(infinity|inf)',
relevance: 0
},
{
className: 'attr',
2024-01-16 21:26:16 +08:00
begin: /([A-Za-z$_#][\w_-]+)=/,
2023-12-18 13:12:25 +08:00
relevance: 0
},
{
className: 'tag',
begin: '</?',
end: '/?>',
relevance: 0
}
]
};
2024-01-16 21:26:16 +08:00
}
module.exports = crmsh;