You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
/*
Language: Extended Backus-Naur Form
Author: Alex McKibben <alex@nullscope.net>
Website: https://en.wikipedia.org/wiki/Extended_Backus– Naur_form
*/
/** @type LanguageFn */
function ebnf ( hljs ) {
const commentMode = hljs . COMMENT ( /\(\*/ , /\*\)/ ) ;
const nonTerminalMode = {
className : "attribute" ,
begin : /^[ ]*[a-zA-Z]+([\s_-]+[a-zA-Z]+)*/
} ;
const specialSequenceMode = {
className : "meta" ,
begin : /\?.*\?/
} ;
const ruleBodyMode = {
begin : /=/ ,
end : /[.;]/ ,
contains : [
commentMode ,
specialSequenceMode ,
{
// terminals
className : 'string' ,
variants : [
hljs . APOS _STRING _MODE ,
hljs . QUOTE _STRING _MODE ,
{
begin : '`' ,
end : '`'
}
]
}
]
} ;
return {
name : 'Extended Backus-Naur Form' ,
illegal : /\S/ ,
contains : [
commentMode ,
nonTerminalMode ,
ruleBodyMode
]
} ;
}
module . exports = ebnf ;