annotate runtime/syntax/rego.vim @ 23910:6cfb5e0231e0

Added tag v8.2.2497 for changeset 5db7d275543cc109d67231ed733e1e596ab689fc
author Bram Moolenaar <Bram@vim.org>
date Wed, 10 Feb 2021 22:30:07 +0100
parents 180a1c5175f6
children 15c80d8bc515
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: rego policy language
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Matt Dunford (zenmatic@gmail.com)
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " URL: https://github.com/zenmatic/vim-syntax-rego
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Last Change: 2019 Dec 12
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " https://www.openpolicyagent.org/docs/latest/policy-language/
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " quit when a (custom) syntax file was already loaded
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 if exists("b:current_syntax")
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 finish
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 endif
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 syn case match
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 syn keyword regoDirective package import allow deny
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 syn keyword regoKeywords as default else false not null true with some
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 syn keyword regoFuncAggregates count sum product max min sort all any
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 syn match regoFuncArrays "\<array\.\(concat\|slice\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 syn keyword regoFuncSets intersection union
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 syn keyword regoFuncStrings concat /\<contains\>/ endswith format_int indexof lower replace split sprintf startswith substring trim trim_left trim_prefix trim_right trim_suffix trim_space upper
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 syn match regoFuncStrings2 "\<strings\.replace_n\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 syn match regoFuncStrings3 "\<contains\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 syn keyword regoFuncRegex re_match
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 syn match regoFuncRegex2 "\<regex\.\(split\|globs_match\|template_match\|find_n\|find_all_string_submatch_n\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 syn match regoFuncGlob "\<glob\.\(match\|quote_meta\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 syn match regoFuncUnits "\<units\.parse_bytes\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 syn keyword regoFuncTypes is_number is_string is_boolean is_array is_set is_object is_null type_name
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 syn match regoFuncEncoding1 "\<\(base64\|base64url\)\.\(encode\|decode\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 syn match regoFuncEncoding2 "\<urlquery\.\(encode\|decode\|encode_object\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 syn match regoFuncEncoding3 "\<\(json\|yaml\)\.\(marshal\|unmarshal\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 syn match regoFuncTokenSigning "\<io\.jwt\.\(encode_sign_raw\|encode_sign\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 syn match regoFuncTokenVerification "\<io\.jwt\.\(verify_rs256\|verify_ps256\|verify_es256\|verify_hs256\|decode\|decode_verify\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 syn match regoFuncTime "\<time\.\(now_ns\|parse_ns\|parse_rfc3339_ns\|parse_duration_ns\|date\|clock\|weekday\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 syn match regoFuncCryptography "\<crypto\.x509\.parse_certificates\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 syn keyword regoFuncGraphs walk
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 syn match regoFuncHttp "\<http\.send\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 syn match regoFuncNet "\<net\.\(cidr_contains\|cidr_intersects\)\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 syn match regoFuncRego "\<rego\.parse_module\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn match regoFuncOpa "\<opa\.runtime\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 syn keyword regoFuncDebugging trace
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 hi def link regoDirective Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 hi def link regoKeywords Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 hi def link regoFuncAggregates Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 hi def link regoFuncArrays Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 hi def link regoFuncSets Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 hi def link regoFuncStrings Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 hi def link regoFuncStrings2 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 hi def link regoFuncStrings3 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 hi def link regoFuncRegex Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 hi def link regoFuncRegex2 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 hi def link regoFuncGlob Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 hi def link regoFuncUnits Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 hi def link regoFuncTypes Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 hi def link regoFuncEncoding1 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 hi def link regoFuncEncoding2 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 hi def link regoFuncEncoding3 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 hi def link regoFuncTokenSigning Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 hi def link regoFuncTokenVerification Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 hi def link regoFuncTime Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 hi def link regoFuncCryptography Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 hi def link regoFuncGraphs Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 hi def link regoFuncHttp Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 hi def link regoFuncNet Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 hi def link regoFuncRego Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 hi def link regoFuncOpa Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 hi def link regoFuncDebugging Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 " https://www.openpolicyagent.org/docs/latest/policy-language/#strings
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 syn region regoString start=+"+ skip=+\\\\\|\\"+ end=+"+
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 syn region regoRawString start=+`+ end=+`+
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 hi def link regoString String
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 hi def link regoRawString String
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 " Comments; their contents
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 syn keyword regoTodo contained TODO FIXME XXX BUG
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 syn cluster regoCommentGroup contains=regoTodo
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 syn region regoComment start="#" end="$" contains=@regoCommentGroup,@Spell
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 hi def link regoComment Comment
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 hi def link regoTodo Todo
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 let b:current_syntax = 'rego'