UNPKG

764 BJavaScriptView Raw
1// https://www.openpolicyagent.org/docs/latest/policy-reference/
2
3Prism.languages.rego = {
4 'comment': /#.*/,
5 'property': {
6 pattern: /(^|[^\\.])(?:"(?:\\.|[^\\"\r\n])*"|`[^`]*`|\b[a-z_]\w*\b)(?=\s*:(?!=))/i,
7 lookbehind: true,
8 greedy: true
9 },
10 'string': {
11 pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"|`[^`]*`/,
12 lookbehind: true,
13 greedy: true
14 },
15
16 'keyword': /\b(?:as|default|else|import|package|not|null|some|with|set(?=\s*\())\b/,
17 'boolean': /\b(?:true|false)\b/,
18
19 'function': {
20 pattern: /\b[a-z_]\w*\b(?:\s*\.\s*\b[a-z_]\w*\b)*(?=\s*\()/i,
21 inside: {
22 'namespace': /\b\w+\b(?=\s*\.)/,
23 'punctuation': /\./
24 }
25 },
26
27 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
28 'operator': /[-+*/%|&]|[<>:=]=?|!=|\b_\b/,
29 'punctuation': /[,;.\[\]{}()]/
30};