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:
944 bytes
|
Line | |
---|
1 | 'use strict'
|
---|
2 |
|
---|
3 | module.exports = rego
|
---|
4 | rego.displayName = 'rego'
|
---|
5 | rego.aliases = []
|
---|
6 | function rego(Prism) {
|
---|
7 | // https://www.openpolicyagent.org/docs/latest/policy-reference/
|
---|
8 | Prism.languages.rego = {
|
---|
9 | comment: /#.*/,
|
---|
10 | property: {
|
---|
11 | pattern:
|
---|
12 | /(^|[^\\.])(?:"(?:\\.|[^\\"\r\n])*"|`[^`]*`|\b[a-z_]\w*\b)(?=\s*:(?!=))/i,
|
---|
13 | lookbehind: true,
|
---|
14 | greedy: true
|
---|
15 | },
|
---|
16 | string: {
|
---|
17 | pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"|`[^`]*`/,
|
---|
18 | lookbehind: true,
|
---|
19 | greedy: true
|
---|
20 | },
|
---|
21 | keyword:
|
---|
22 | /\b(?:as|default|else|import|not|null|package|set(?=\s*\()|some|with)\b/,
|
---|
23 | boolean: /\b(?:false|true)\b/,
|
---|
24 | function: {
|
---|
25 | pattern: /\b[a-z_]\w*\b(?:\s*\.\s*\b[a-z_]\w*\b)*(?=\s*\()/i,
|
---|
26 | inside: {
|
---|
27 | namespace: /\b\w+\b(?=\s*\.)/,
|
---|
28 | punctuation: /\./
|
---|
29 | }
|
---|
30 | },
|
---|
31 | number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
---|
32 | operator: /[-+*/%|&]|[<>:=]=?|!=|\b_\b/,
|
---|
33 | punctuation: /[,;.\[\]{}()]/
|
---|
34 | }
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.