]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/ebnf.js
Initial commit.
[flow-web.git] / static / highlight / languages / ebnf.js
1 /*! `ebnf` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: Extended Backus-Naur Form
8 Author: Alex McKibben <alex@nullscope.net>
9 Website: https://en.wikipedia.org/wiki/Extended_Backus–Naur_form
10 Category: syntax
11 */
12
13 /** @type LanguageFn */
14 function ebnf(hljs) {
15 const commentMode = hljs.COMMENT(/\(\*/, /\*\)/);
16
17 const nonTerminalMode = {
18 className: "attribute",
19 begin: /^[ ]*[a-zA-Z]+([\s_-]+[a-zA-Z]+)*/
20 };
21
22 const specialSequenceMode = {
23 className: "meta",
24 begin: /\?.*\?/
25 };
26
27 const ruleBodyMode = {
28 begin: /=/,
29 end: /[.;]/,
30 contains: [
31 commentMode,
32 specialSequenceMode,
33 {
34 // terminals
35 className: 'string',
36 variants: [
37 hljs.APOS_STRING_MODE,
38 hljs.QUOTE_STRING_MODE,
39 {
40 begin: '`',
41 end: '`'
42 }
43 ]
44 }
45 ]
46 };
47
48 return {
49 name: 'Extended Backus-Naur Form',
50 illegal: /\S/,
51 contains: [
52 commentMode,
53 nonTerminalMode,
54 ruleBodyMode
55 ]
56 };
57 }
58
59 return ebnf;
60
61 })();
62
63 hljs.registerLanguage('ebnf', hljsGrammar);
64 })();