source: node_modules/refractor/lang/firestore-security-rules.js@ d24f17c

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.3 KB
Line 
1'use strict'
2
3module.exports = firestoreSecurityRules
4firestoreSecurityRules.displayName = 'firestoreSecurityRules'
5firestoreSecurityRules.aliases = []
6function firestoreSecurityRules(Prism) {
7 Prism.languages['firestore-security-rules'] = Prism.languages.extend(
8 'clike',
9 {
10 comment: /\/\/.*/,
11 keyword:
12 /\b(?:allow|function|if|match|null|return|rules_version|service)\b/,
13 operator: /&&|\|\||[<>!=]=?|[-+*/%]|\b(?:in|is)\b/
14 }
15 )
16 delete Prism.languages['firestore-security-rules']['class-name']
17 Prism.languages.insertBefore('firestore-security-rules', 'keyword', {
18 path: {
19 pattern:
20 /(^|[\s(),])(?:\/(?:[\w\xA0-\uFFFF]+|\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)))+/,
21 lookbehind: true,
22 greedy: true,
23 inside: {
24 variable: {
25 pattern: /\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)/,
26 inside: {
27 operator: /=/,
28 keyword: /\*\*/,
29 punctuation: /[.$(){}]/
30 }
31 },
32 punctuation: /\//
33 }
34 },
35 method: {
36 // to make the pattern shorter, the actual method names are omitted
37 pattern: /(\ballow\s+)[a-z]+(?:\s*,\s*[a-z]+)*(?=\s*[:;])/,
38 lookbehind: true,
39 alias: 'builtin',
40 inside: {
41 punctuation: /,/
42 }
43 }
44 })
45}
Note: See TracBrowser for help on using the repository browser.