1 | 'use strict'
|
---|
2 |
|
---|
3 | module.exports = nevod
|
---|
4 | nevod.displayName = 'nevod'
|
---|
5 | nevod.aliases = []
|
---|
6 | function nevod(Prism) {
|
---|
7 | Prism.languages.nevod = {
|
---|
8 | comment: /\/\/.*|(?:\/\*[\s\S]*?(?:\*\/|$))/,
|
---|
9 | string: {
|
---|
10 | pattern: /(?:"(?:""|[^"])*"(?!")|'(?:''|[^'])*'(?!'))!?\*?/,
|
---|
11 | greedy: true,
|
---|
12 | inside: {
|
---|
13 | 'string-attrs': /!$|!\*$|\*$/
|
---|
14 | }
|
---|
15 | },
|
---|
16 | namespace: {
|
---|
17 | pattern: /(@namespace\s+)[a-zA-Z0-9\-.]+(?=\s*\{)/,
|
---|
18 | lookbehind: true
|
---|
19 | },
|
---|
20 | pattern: {
|
---|
21 | pattern:
|
---|
22 | /(@pattern\s+)?#?[a-zA-Z0-9\-.]+(?:\s*\(\s*(?:~\s*)?[a-zA-Z0-9\-.]+\s*(?:,\s*(?:~\s*)?[a-zA-Z0-9\-.]*)*\))?(?=\s*=)/,
|
---|
23 | lookbehind: true,
|
---|
24 | inside: {
|
---|
25 | 'pattern-name': {
|
---|
26 | pattern: /^#?[a-zA-Z0-9\-.]+/,
|
---|
27 | alias: 'class-name'
|
---|
28 | },
|
---|
29 | fields: {
|
---|
30 | pattern: /\(.*\)/,
|
---|
31 | inside: {
|
---|
32 | 'field-name': {
|
---|
33 | pattern: /[a-zA-Z0-9\-.]+/,
|
---|
34 | alias: 'variable'
|
---|
35 | },
|
---|
36 | punctuation: /[,()]/,
|
---|
37 | operator: {
|
---|
38 | pattern: /~/,
|
---|
39 | alias: 'field-hidden-mark'
|
---|
40 | }
|
---|
41 | }
|
---|
42 | }
|
---|
43 | }
|
---|
44 | },
|
---|
45 | search: {
|
---|
46 | pattern: /(@search\s+|#)[a-zA-Z0-9\-.]+(?:\.\*)?(?=\s*;)/,
|
---|
47 | alias: 'function',
|
---|
48 | lookbehind: true
|
---|
49 | },
|
---|
50 | keyword:
|
---|
51 | /@(?:having|inside|namespace|outside|pattern|require|search|where)\b/,
|
---|
52 | 'standard-pattern': {
|
---|
53 | pattern:
|
---|
54 | /\b(?:Alpha|AlphaNum|Any|Blank|End|LineBreak|Num|NumAlpha|Punct|Space|Start|Symbol|Word|WordBreak)\b(?:\([a-zA-Z0-9\-.,\s+]*\))?/,
|
---|
55 | inside: {
|
---|
56 | 'standard-pattern-name': {
|
---|
57 | pattern: /^[a-zA-Z0-9\-.]+/,
|
---|
58 | alias: 'builtin'
|
---|
59 | },
|
---|
60 | quantifier: {
|
---|
61 | pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/,
|
---|
62 | alias: 'number'
|
---|
63 | },
|
---|
64 | 'standard-pattern-attr': {
|
---|
65 | pattern: /[a-zA-Z0-9\-.]+/,
|
---|
66 | alias: 'builtin'
|
---|
67 | },
|
---|
68 | punctuation: /[,()]/
|
---|
69 | }
|
---|
70 | },
|
---|
71 | quantifier: {
|
---|
72 | pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/,
|
---|
73 | alias: 'number'
|
---|
74 | },
|
---|
75 | operator: [
|
---|
76 | {
|
---|
77 | pattern: /=/,
|
---|
78 | alias: 'pattern-def'
|
---|
79 | },
|
---|
80 | {
|
---|
81 | pattern: /&/,
|
---|
82 | alias: 'conjunction'
|
---|
83 | },
|
---|
84 | {
|
---|
85 | pattern: /~/,
|
---|
86 | alias: 'exception'
|
---|
87 | },
|
---|
88 | {
|
---|
89 | pattern: /\?/,
|
---|
90 | alias: 'optionality'
|
---|
91 | },
|
---|
92 | {
|
---|
93 | pattern: /[[\]]/,
|
---|
94 | alias: 'repetition'
|
---|
95 | },
|
---|
96 | {
|
---|
97 | pattern: /[{}]/,
|
---|
98 | alias: 'variation'
|
---|
99 | },
|
---|
100 | {
|
---|
101 | pattern: /[+_]/,
|
---|
102 | alias: 'sequence'
|
---|
103 | },
|
---|
104 | {
|
---|
105 | pattern: /\.{2,3}/,
|
---|
106 | alias: 'span'
|
---|
107 | }
|
---|
108 | ],
|
---|
109 | 'field-capture': [
|
---|
110 | {
|
---|
111 | pattern:
|
---|
112 | /([a-zA-Z0-9\-.]+\s*\()\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+(?:\s*,\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+)*(?=\s*\))/,
|
---|
113 | lookbehind: true,
|
---|
114 | inside: {
|
---|
115 | 'field-name': {
|
---|
116 | pattern: /[a-zA-Z0-9\-.]+/,
|
---|
117 | alias: 'variable'
|
---|
118 | },
|
---|
119 | colon: /:/
|
---|
120 | }
|
---|
121 | },
|
---|
122 | {
|
---|
123 | pattern: /[a-zA-Z0-9\-.]+\s*:/,
|
---|
124 | inside: {
|
---|
125 | 'field-name': {
|
---|
126 | pattern: /[a-zA-Z0-9\-.]+/,
|
---|
127 | alias: 'variable'
|
---|
128 | },
|
---|
129 | colon: /:/
|
---|
130 | }
|
---|
131 | }
|
---|
132 | ],
|
---|
133 | punctuation: /[:;,()]/,
|
---|
134 | name: /[a-zA-Z0-9\-.]+/
|
---|
135 | }
|
---|
136 | }
|
---|