summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-firestore-security-rules.min.js
blob: 0bb4904878c6044bf6eb035412790a2edaf5f2f9 (plain)
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
(Prism.languages['firestore-security-rules'] = Prism.languages.extend('clike', {
  comment: /\/\/.*/,
  keyword: /\b(?:allow|function|if|match|null|return|rules_version|service)\b/,
  operator: /&&|\|\||[<>!=]=?|[-+*/%]|\b(?:in|is)\b/,
})),
  delete Prism.languages['firestore-security-rules']['class-name'],
  Prism.languages.insertBefore('firestore-security-rules', 'keyword', {
    path: {
      pattern:
        /(^|[\s(),])(?:\/(?:[\w\xA0-\uFFFF]+|\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)))+/,
      lookbehind: !0,
      greedy: !0,
      inside: {
        variable: {
          pattern: /\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)/,
          inside: { operator: /=/, keyword: /\*\*/, punctuation: /[.$(){}]/ },
        },
        punctuation: /\//,
      },
    },
    method: {
      pattern: /(\ballow\s+)[a-z]+(?:\s*,\s*[a-z]+)*(?=\s*[:;])/,
      lookbehind: !0,
      alias: 'builtin',
      inside: { punctuation: /,/ },
    },
  });
>inside: null, // see below }, { pattern: RegExp( /<type>(?=\s+is\b)/.source.replace(/<type>/g, function () { return type; }), 'i' ), inside: null, // see below }, { pattern: RegExp( /(:\s*)<type>/.source.replace(/<type>/g, function () { return type; }) ), lookbehind: true, inside: null, // see below }, ], keyword: { pattern: /(^|[^&])\b(?:begin|block|case|const|else|end|fail|for|from|function|if|is|nil|of|remove|return|skip|then|type|var|while|with)\b/i, lookbehind: true, }, boolean: { pattern: /(^|[^&])\b(?:False|True)\b/i, lookbehind: true, }, builtin: { pattern: /(^|[^&])\b(?:bool|int|list|map|nat|record|string|unit)\b/i, lookbehind: true, }, function: /\b\w+(?=\s*\()/, number: [ // Hexadecimal, octal and binary /%[01]+|&[0-7]+|\$[a-f\d]+/i, // Decimal /\b\d+(?:\.\d+)?(?:e[+-]?\d+)?(?:mtz|n)?/i, ], operator: /->|=\/=|\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=|]|\b(?:and|mod|or)\b/, punctuation: /\(\.|\.\)|[()\[\]:;,.{}]/, }); var classNameInside = [ 'comment', 'keyword', 'builtin', 'operator', 'punctuation', ].reduce(function (accum, key) { accum[key] = pascaligo[key]; return accum; }, {}); pascaligo['class-name'].forEach(function (p) { p.inside = classNameInside; }); })(Prism);