mirror of
https://github.com/Funkoala14/knowledgebase_law.git
synced 2025-06-08 21:59:44 +08:00
28 lines
616 B
JavaScript
28 lines
616 B
JavaScript
'use strict'
|
|
|
|
module.exports = ebnf
|
|
ebnf.displayName = 'ebnf'
|
|
ebnf.aliases = []
|
|
function ebnf(Prism) {
|
|
Prism.languages.ebnf = {
|
|
comment: /\(\*[\s\S]*?\*\)/,
|
|
string: {
|
|
pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
|
|
greedy: true
|
|
},
|
|
special: {
|
|
pattern: /\?[^?\r\n]*\?/,
|
|
greedy: true,
|
|
alias: 'class-name'
|
|
},
|
|
definition: {
|
|
pattern: /^([\t ]*)[a-z]\w*(?:[ \t]+[a-z]\w*)*(?=\s*=)/im,
|
|
lookbehind: true,
|
|
alias: ['rule', 'keyword']
|
|
},
|
|
rule: /\b[a-z]\w*(?:[ \t]+[a-z]\w*)*\b/i,
|
|
punctuation: /\([:/]|[:/]\)|[.,;()[\]{}]/,
|
|
operator: /[-=|*/!]/
|
|
}
|
|
}
|