tibi-docs/.yarn/unplugged/highlight.js-npm-9.18.5-571500f48d/node_modules/highlight.js/lib/languages/ebnf.js
2022-11-02 06:40:25 +00:00

39 lines
875 B
JavaScript

module.exports = function(hljs) {
var commentMode = hljs.COMMENT(/\(\*/, /\*\)/);
var nonTerminalMode = {
className: "attribute",
begin: /^[ ]*[a-zA-Z][a-zA-Z-_]*([\s-_]+[a-zA-Z][a-zA-Z]*)*/
};
var specialSequenceMode = {
className: "meta",
begin: /\?.*\?/
};
var ruleBodyMode = {
begin: /=/, end: /[.;]/,
contains: [
commentMode,
specialSequenceMode,
{
// terminals
className: 'string',
variants: [
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{begin: '`', end: '`'},
]
},
]
};
return {
illegal: /\S/,
contains: [
commentMode,
nonTerminalMode,
ruleBodyMode
]
};
};