summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-rego.min.js
blob: f53ac19d155bf4cd707fcc3e131b23e5d1ff3049 (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
Prism.languages.rego = {
  comment: /#.*/,
  property: {
    pattern:
      /(^|[^\\.])(?:"(?:\\.|[^\\"\r\n])*"|`[^`]*`|\b[a-z_]\w*\b)(?=\s*:(?!=))/i,
    lookbehind: !0,
    greedy: !0,
  },
  string: {
    pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"|`[^`]*`/,
    lookbehind: !0,
    greedy: !0,
  },
  keyword:
    /\b(?:as|default|else|import|not|null|package|set(?=\s*\()|some|with)\b/,
  boolean: /\b(?:false|true)\b/,
  function: {
    pattern: /\b[a-z_]\w*\b(?:\s*\.\s*\b[a-z_]\w*\b)*(?=\s*\()/i,
    inside: { namespace: /\b\w+\b(?=\s*\.)/, punctuation: /\./ },
  },
  number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  operator: /[-+*/%|&]|[<>:=]=?|!=|\b_\b/,
  punctuation: /[,;.\[\]{}()]/,
};
an>, }, expression: { pattern: /[\s\S]+/, inside: null, // see below }, }, }, string: /[\s\S]+/, }, }, keyword: /\b(?:else|if)\b/, boolean: /\b(?:false|true)\b/, 'builtin-function': { // a few functions get special highlighting to improve readability pattern: /\b(?:assert|defined|foreach|import|pool|print|template|tool|toolchain)(?=\s*\()/i, alias: 'keyword', }, function: /\b[a-z_]\w*(?=\s*\()/i, constant: /\b(?:current_cpu|current_os|current_toolchain|default_toolchain|host_cpu|host_os|root_build_dir|root_gen_dir|root_out_dir|target_cpu|target_gen_dir|target_os|target_out_dir)\b/, number: /-?\b\d+\b/, operator: /[-+!=<>]=?|&&|\|\|/, punctuation: /[(){}[\],.]/, }; Prism.languages.gn['string-literal'].inside['interpolation'].inside[ 'expression' ].inside = Prism.languages.gn; Prism.languages.gni = Prism.languages.gn;