mirror of
https://github.com/Funkoala14/knowledgebase_law.git
synced 2025-06-08 20:48:15 +08:00
28 lines
543 B
JavaScript
28 lines
543 B
JavaScript
'use strict'
|
|
|
|
module.exports = bnf
|
|
bnf.displayName = 'bnf'
|
|
bnf.aliases = ['rbnf']
|
|
function bnf(Prism) {
|
|
Prism.languages.bnf = {
|
|
string: {
|
|
pattern: /"[^\r\n"]*"|'[^\r\n']*'/
|
|
},
|
|
definition: {
|
|
pattern: /<[^<>\r\n\t]+>(?=\s*::=)/,
|
|
alias: ['rule', 'keyword'],
|
|
inside: {
|
|
punctuation: /^<|>$/
|
|
}
|
|
},
|
|
rule: {
|
|
pattern: /<[^<>\r\n\t]+>/,
|
|
inside: {
|
|
punctuation: /^<|>$/
|
|
}
|
|
},
|
|
operator: /::=|[|()[\]{}*+?]|\.{3}/
|
|
}
|
|
Prism.languages.rbnf = Prism.languages.bnf
|
|
}
|