annotate runtime/syntax/rego.vim @ 34636:c94ef9458309 v9.1.0204

patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab' Commit: https://github.com/vim/vim/commit/0185c7701434f1fbbf83fecd6384a19c1d2fc44e Author: zeertzjq <zeertzjq@outlook.com> Date: Mon Mar 25 16:34:51 2024 +0100 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab' Problem: Backspace inserts spaces with virtual text and 'smarttab'. Solution: Ignore virtual text and wrapping when backspacing. (zeertzjq) related: neovim/neovim#28005 closes: #14296 Co-authored-by: VanaIgr <vanaigranov@gmail.com> Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 25 Mar 2024 16:45:04 +0100
parents 15c80d8bc515
children
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
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
5 " Last Change: 2022 Dec 4
18928
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
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
17 syn keyword regoKeywords as default else every false if import package not null true with some in print
18928
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
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
20 syn match regoFuncArrays "\<array\.\(concat\|slice\|reverse\)\>"
18928
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
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
23 syn keyword regoFuncStrings concat /\<contains\>/ endswith format_int indexof indexof_n lower replace split sprintf startswith substring trim trim_left trim_prefix trim_right trim_suffix trim_space upper
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
24 syn match regoFuncStrings2 "\<strings\.\(replace_n\|reverse\|any_prefix_match\|any_suffix_match\)\>"
18928
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
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
28 syn match regoFuncRegex2 "\<regex\.\(is_valid\|split\|globs_match\|template_match\|find_n\|find_all_string_submatch_n\|replace\)\>"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
30 syn match regoFuncUuid "\<uuid.rfc4122\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
31 syn match regoFuncBits "\<bits\.\(or\|and\|negate\|xor\|lsh\|rsh\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
32 syn match regoFuncObject "\<object\.\(get\|remove\|subset\|union\|union_n\|filter\)\>"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 syn match regoFuncGlob "\<glob\.\(match\|quote_meta\)\>"
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
34 syn match regoFuncUnits "\<units\.parse\(_bytes\)\=\>"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 syn keyword regoFuncTypes is_number is_string is_boolean is_array is_set is_object is_null type_name
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
36 syn match regoFuncEncoding1 "\<base64\.\(encode\|decode\|is_valid\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
37 syn match regoFuncEncoding2 "\<base64url\.\(encode\(_no_pad\)\=\|decode\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
38 syn match regoFuncEncoding3 "\<urlquery\.\(encode\|decode\|\(en\|de\)code_object\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
39 syn match regoFuncEncoding4 "\<\(json\|yaml\)\.\(is_valid\|marshal\|unmarshal\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
40 syn match regoFuncEncoding5 "\<json\.\(filter\|patch\|remove\)\>"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 syn match regoFuncTokenSigning "\<io\.jwt\.\(encode_sign_raw\|encode_sign\)\>"
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
42 syn match regoFuncTokenVerification1 "\<io\.jwt\.\(decode\|decode_verify\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
43 syn match regoFuncTokenVerification2 "\<io\.jwt\.verify_\(rs\|ps\|es\|hs\)\(256\|384\|512\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
44 syn match regoFuncTime "\<time\.\(now_ns\|parse_ns\|parse_rfc3339_ns\|parse_duration_ns\|date\|clock\|weekday\|diff\|add_date\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
45 syn match regoFuncCryptography "\<crypto\.x509\.\(parse_certificates\|parse_certificate_request\|parse_and_verify_certificates\|parse_rsa_private_key\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
46 syn match regoFuncCryptography "\<crypto\.\(md5\|sha1\|sha256\)"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
47 syn match regoFuncCryptography "\<crypto\.hmac\.\(md5\|sha1\|sha256\|sha512\)"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 syn keyword regoFuncGraphs walk
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
49 syn match regoFuncGraphs2 "\<graph\.reachable\(_paths\)\=\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
50 syn match regoFuncGraphQl "\<graphql\.\(\(schema_\)\=is_valid\|parse\(_\(and_verify\|query\|schema\)\)\=\)\>"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 syn match regoFuncHttp "\<http\.send\>"
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
52 syn match regoFuncNet "\<net\.\(cidr_merge\|cidr_contains\|cidr_contains_matches\|cidr_intersects\|cidr_expand\|lookup_ip_addr\|cidr_is_valid\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
53 syn match regoFuncRego "\<rego\.\(parse_module\|metadata\.\(rule\|chain\)\)\>"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 syn match regoFuncOpa "\<opa\.runtime\>"
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 syn keyword regoFuncDebugging trace
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
56 syn match regoFuncRand "\<rand\.intn\>"
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
58 syn match regoFuncNumbers "\<numbers\.\(range\|intn\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
59 syn keyword regoFuncNumbers round ceil floor abs
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
60
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
61 syn match regoFuncSemver "\<semver\.\(is_valid\|compare\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
62 syn keyword regoFuncConversions to_number
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
63 syn match regoFuncHex "\<hex\.\(encode\|decode\)\>"
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
64
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
65 hi def link regoFuncUuid Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
66 hi def link regoFuncBits Statement
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 hi def link regoDirective Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 hi def link regoKeywords Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 hi def link regoFuncAggregates Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 hi def link regoFuncArrays Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 hi def link regoFuncSets Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 hi def link regoFuncStrings Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 hi def link regoFuncStrings2 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 hi def link regoFuncStrings3 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 hi def link regoFuncRegex Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 hi def link regoFuncRegex2 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 hi def link regoFuncGlob Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 hi def link regoFuncUnits Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 hi def link regoFuncTypes Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 hi def link regoFuncEncoding1 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 hi def link regoFuncEncoding2 Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 hi def link regoFuncEncoding3 Statement
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
83 hi def link regoFuncEncoding4 Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
84 hi def link regoFuncEncoding5 Statement
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 hi def link regoFuncTokenSigning Statement
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
86 hi def link regoFuncTokenVerification1 Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
87 hi def link regoFuncTokenVerification2 Statement
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 hi def link regoFuncTime Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 hi def link regoFuncCryptography Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 hi def link regoFuncGraphs Statement
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
91 hi def link regoFuncGraphQl Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
92 hi def link regoFuncGraphs2 Statement
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 hi def link regoFuncHttp Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 hi def link regoFuncNet Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 hi def link regoFuncRego Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 hi def link regoFuncOpa Statement
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 hi def link regoFuncDebugging Statement
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
98 hi def link regoFuncObject Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
99 hi def link regoFuncNumbers Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
100 hi def link regoFuncSemver Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
101 hi def link regoFuncConversions Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
102 hi def link regoFuncHex Statement
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18928
diff changeset
103 hi def link regoFuncRand Statement
18928
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 " https://www.openpolicyagent.org/docs/latest/policy-language/#strings
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 syn region regoString start=+"+ skip=+\\\\\|\\"+ end=+"+
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 syn region regoRawString start=+`+ end=+`+
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 hi def link regoString String
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 hi def link regoRawString String
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 " Comments; their contents
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 syn keyword regoTodo contained TODO FIXME XXX BUG
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 syn cluster regoCommentGroup contains=regoTodo
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 syn region regoComment start="#" end="$" contains=@regoCommentGroup,@Spell
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 hi def link regoComment Comment
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 hi def link regoTodo Todo
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119
180a1c5175f6 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 let b:current_syntax = 'rego'