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