-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
prism-nevod.js
89 lines (89 loc) · 1.78 KB
/
prism-nevod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Prism.languages.nevod = {
'comment': /\/\/.*|(?:\/\*[\s\S]*?(?:\*\/|$))/,
'string': {
pattern: /(?:"(?:""|[^"])*"(?!")|'(?:''|[^'])*'(?!'))!?\*?/,
greedy: true,
inside: {
'string-attrs': /!$|!\*$|\*$/,
},
},
'namespace': {
pattern: /(@namespace\s+)[a-zA-Z0-9\-.]+(?=\s*{)/,
lookbehind: true,
},
'pattern': {
pattern: /(@pattern\s+)?#?[a-zA-Z0-9\-.]+(?:\s*(?:[(]\s*(?:(?:~\s*)?[a-zA-Z0-9\-.]+\s*(?:,\s*(?:(?:~\s*)?[a-zA-Z0-9\-.]*))*)[)]))?(?=\s*=)/,
lookbehind: true,
inside: {
'pattern-name': {
pattern: /#?[a-zA-Z0-9\-.]+/,
alias: 'class-name',
},
'attributes': {
pattern: /\(.*\)/,
inside: {
'attr-name': /[a-zA-Z0-9\-.]+/,
'attr-hidden-mark': /~/,
'attr-punctuation': /[,]/,
'attr-bracket': /[()]/,
},
},
},
},
'search': {
pattern: /(@search\s+|#)[a-zA-Z0-9\-.]+\s*(?:\.\*\s*)?(?:;)/,
alias: 'function',
lookbehind: true,
},
'keyword': /@(?:require|namespace|pattern|search|inside|outside|having|where)\b/,
'builtin': {
pattern: /\b(?:Word|Punct|Symbol|Space|LineBreak|Start|End|Alpha|AlphaNum|Num|NumAlpha|Blank|WordBreak|Any)(?:\(.*\)|\b)/,
inside: {
'name': /.+\b/,
'params': /\(.*\)/,
},
},
'quantifier': {
pattern: /\b\d+(?:\+|-\d+)?\b/,
alias: 'number',
},
'operator': [
{
pattern: /&/,
alias: 'conjunction',
},
{
pattern: /~/,
alias: 'exception',
},
{
pattern: /\?/,
alias: 'optionality',
},
{
pattern: /[[\]]/,
alias: 'repetition',
},
{
pattern: /[{}]/,
alias: 'variation',
},
{
pattern: /[+_]/,
alias: 'sequence',
},
{
pattern: /\.{2,3}/,
alias: 'span',
},
],
'attr-capture': {
pattern: /[a-zA-Z0-9\-.]+\s*:/,
inside: {
'attr-name': /[a-zA-Z0-9\-.]+/,
'colon': /:/,
},
},
'punctuation': /[:;,()=]/,
'name': /\S+/
}