main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | (function (Prism) {
|
---|
| 2 |
|
---|
| 3 | var coreRules = '(?:ALPHA|BIT|CHAR|CR|CRLF|CTL|DIGIT|DQUOTE|HEXDIG|HTAB|LF|LWSP|OCTET|SP|VCHAR|WSP)';
|
---|
| 4 |
|
---|
| 5 | Prism.languages.abnf = {
|
---|
| 6 | 'comment': /;.*/,
|
---|
| 7 | 'string': {
|
---|
| 8 | pattern: /(?:%[is])?"[^"\n\r]*"/,
|
---|
| 9 | greedy: true,
|
---|
| 10 | inside: {
|
---|
| 11 | 'punctuation': /^%[is]/
|
---|
| 12 | }
|
---|
| 13 | },
|
---|
| 14 | 'range': {
|
---|
| 15 | pattern: /%(?:b[01]+-[01]+|d\d+-\d+|x[A-F\d]+-[A-F\d]+)/i,
|
---|
| 16 | alias: 'number'
|
---|
| 17 | },
|
---|
| 18 | 'terminal': {
|
---|
| 19 | pattern: /%(?:b[01]+(?:\.[01]+)*|d\d+(?:\.\d+)*|x[A-F\d]+(?:\.[A-F\d]+)*)/i,
|
---|
| 20 | alias: 'number'
|
---|
| 21 | },
|
---|
| 22 | 'repetition': {
|
---|
| 23 | pattern: /(^|[^\w-])(?:\d*\*\d*|\d+)/,
|
---|
| 24 | lookbehind: true,
|
---|
| 25 | alias: 'operator'
|
---|
| 26 | },
|
---|
| 27 | 'definition': {
|
---|
| 28 | pattern: /(^[ \t]*)(?:[a-z][\w-]*|<[^<>\r\n]*>)(?=\s*=)/m,
|
---|
| 29 | lookbehind: true,
|
---|
| 30 | alias: 'keyword',
|
---|
| 31 | inside: {
|
---|
| 32 | 'punctuation': /<|>/
|
---|
| 33 | }
|
---|
| 34 | },
|
---|
| 35 | 'core-rule': {
|
---|
| 36 | pattern: RegExp('(?:(^|[^<\\w-])' + coreRules + '|<' + coreRules + '>)(?![\\w-])', 'i'),
|
---|
| 37 | lookbehind: true,
|
---|
| 38 | alias: ['rule', 'constant'],
|
---|
| 39 | inside: {
|
---|
| 40 | 'punctuation': /<|>/
|
---|
| 41 | }
|
---|
| 42 | },
|
---|
| 43 | 'rule': {
|
---|
| 44 | pattern: /(^|[^<\w-])[a-z][\w-]*|<[^<>\r\n]*>/i,
|
---|
| 45 | lookbehind: true,
|
---|
| 46 | inside: {
|
---|
| 47 | 'punctuation': /<|>/
|
---|
| 48 | }
|
---|
| 49 | },
|
---|
| 50 | 'operator': /=\/?|\//,
|
---|
| 51 | 'punctuation': /[()\[\]]/
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 | }(Prism));
|
---|
Note:
See
TracBrowser
for help on using the repository browser.