97 lines
2.3 KiB
JavaScript
97 lines
2.3 KiB
JavaScript
|
module.exports = function(hljs) {
|
||
|
var RESOURCES = 'primitive rsc_template';
|
||
|
|
||
|
var COMMANDS = 'group clone ms master location colocation order fencing_topology ' +
|
||
|
'rsc_ticket acl_target acl_group user role ' +
|
||
|
'tag xml';
|
||
|
|
||
|
var PROPERTY_SETS = 'property rsc_defaults op_defaults';
|
||
|
|
||
|
var KEYWORDS = 'params meta operations op rule attributes utilization';
|
||
|
|
||
|
var OPERATORS = 'read write deny defined not_defined in_range date spec in ' +
|
||
|
'ref reference attribute type xpath version and or lt gt tag ' +
|
||
|
'lte gte eq ne \\';
|
||
|
|
||
|
var TYPES = 'number string';
|
||
|
|
||
|
var LITERALS = 'Master Started Slave Stopped start promote demote stop monitor true false';
|
||
|
|
||
|
return {
|
||
|
aliases: ['crm', 'pcmk'],
|
||
|
case_insensitive: true,
|
||
|
keywords: {
|
||
|
keyword: KEYWORDS,
|
||
|
operator: OPERATORS,
|
||
|
type: TYPES,
|
||
|
literal: LITERALS
|
||
|
},
|
||
|
contains: [
|
||
|
hljs.HASH_COMMENT_MODE,
|
||
|
{
|
||
|
beginKeywords: 'node',
|
||
|
starts: {
|
||
|
className: 'identifier',
|
||
|
end: '\\s*([\\w_-]+:)?',
|
||
|
starts: {
|
||
|
className: 'title',
|
||
|
end: '\\s*[\\$\\w_][\\w_-]*'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
beginKeywords: RESOURCES,
|
||
|
starts: {
|
||
|
className: 'title',
|
||
|
end: '\\s*[\\$\\w_][\\w_-]*',
|
||
|
starts: {
|
||
|
className: 'pragma',
|
||
|
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: 'pragma',
|
||
|
begin: '(ocf|systemd|service|lsb):[\\w_:-]+',
|
||
|
relevance: 0
|
||
|
},
|
||
|
{
|
||
|
className: 'number',
|
||
|
begin: '\\b\\d+(\\.\\d+)?(ms|s|h|m)?',
|
||
|
relevance: 0
|
||
|
},
|
||
|
{
|
||
|
className: 'number',
|
||
|
begin: '[-]?(infinity|inf)',
|
||
|
relevance: 0
|
||
|
},
|
||
|
{
|
||
|
className: 'variable',
|
||
|
begin: /([A-Za-z\$_\#][\w_-]+)=/,
|
||
|
relevance: 0
|
||
|
},
|
||
|
{
|
||
|
className: 'tag',
|
||
|
begin: '</?',
|
||
|
end: '/?>',
|
||
|
relevance: 0
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
};
|