UNPKG

1 kBJavaScriptView Raw
1Prism.languages['firestore-security-rules'] = Prism.languages.extend('clike', {
2 'comment': /\/\/.*/,
3 'keyword': /\b(?:allow|function|if|match|null|return|rules_version|service)\b/,
4 'operator': /&&|\|\||[<>!=]=?|[-+*/%]|\b(?:in|is)\b/,
5});
6
7delete Prism.languages['firestore-security-rules']['class-name'];
8
9Prism.languages.insertBefore('firestore-security-rules', 'keyword', {
10 'path': {
11 pattern: /(^|[\s(),])(?:\/(?:[\w\xA0-\uFFFF]+|\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)))+/,
12 lookbehind: true,
13 greedy: true,
14 inside: {
15 'variable': {
16 pattern: /\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)/,
17 inside: {
18 'operator': /=/,
19 'keyword': /\*\*/,
20 'punctuation': /[.$(){}]/
21 }
22 },
23 'punctuation': /\//
24 }
25 },
26 'method': {
27 // to make the pattern shorter, the actual method names are omitted
28 pattern: /(\ballow\s+)[a-z]+(?:\s*,\s*[a-z]+)*(?=\s*[:;])/,
29 lookbehind: true,
30 alias: 'builtin',
31 inside: {
32 'punctuation': /,/
33 }
34 },
35});