From bc9757916ed09763d96283ee62dbed58bd713a11 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 6 Oct 2020 18:54:19 +0200 Subject: Add all vim filetypes --- syntax/rego.vim | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 syntax/rego.vim (limited to 'syntax/rego.vim') diff --git a/syntax/rego.vim b/syntax/rego.vim new file mode 100644 index 00000000..6a4fdec0 --- /dev/null +++ b/syntax/rego.vim @@ -0,0 +1,93 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rego') == -1 + +" Vim syntax file +" Language: rego policy language +" Maintainer: Matt Dunford (zenmatic@gmail.com) +" URL: https://github.com/zenmatic/vim-syntax-rego +" Last Change: 2019 Dec 12 + +" https://www.openpolicyagent.org/docs/latest/policy-language/ + +" quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +syn case match + +syn keyword regoDirective package import allow deny +syn keyword regoKeywords as default else false not null true with some + +syn keyword regoFuncAggregates count sum product max min sort all any +syn match regoFuncArrays "\" +syn keyword regoFuncSets intersection union + +syn keyword regoFuncStrings concat /\/ endswith format_int indexof lower replace split sprintf startswith substring trim trim_left trim_prefix trim_right trim_suffix trim_space upper +syn match regoFuncStrings2 "\" +syn match regoFuncStrings3 "\" + +syn keyword regoFuncRegex re_match +syn match regoFuncRegex2 "\" + +syn match regoFuncGlob "\" +syn match regoFuncUnits "\" +syn keyword regoFuncTypes is_number is_string is_boolean is_array is_set is_object is_null type_name +syn match regoFuncEncoding1 "\<\(base64\|base64url\)\.\(encode\|decode\)\>" +syn match regoFuncEncoding2 "\" +syn match regoFuncEncoding3 "\<\(json\|yaml\)\.\(marshal\|unmarshal\)\>" +syn match regoFuncTokenSigning "\" +syn match regoFuncTokenVerification "\" +syn match regoFuncTime "\" +syn match regoFuncCryptography "\" +syn keyword regoFuncGraphs walk +syn match regoFuncHttp "\" +syn match regoFuncNet "\" +syn match regoFuncRego "\" +syn match regoFuncOpa "\" +syn keyword regoFuncDebugging trace + +hi def link regoDirective Statement +hi def link regoKeywords Statement +hi def link regoFuncAggregates Statement +hi def link regoFuncArrays Statement +hi def link regoFuncSets Statement +hi def link regoFuncStrings Statement +hi def link regoFuncStrings2 Statement +hi def link regoFuncStrings3 Statement +hi def link regoFuncRegex Statement +hi def link regoFuncRegex2 Statement +hi def link regoFuncGlob Statement +hi def link regoFuncUnits Statement +hi def link regoFuncTypes Statement +hi def link regoFuncEncoding1 Statement +hi def link regoFuncEncoding2 Statement +hi def link regoFuncEncoding3 Statement +hi def link regoFuncTokenSigning Statement +hi def link regoFuncTokenVerification Statement +hi def link regoFuncTime Statement +hi def link regoFuncCryptography Statement +hi def link regoFuncGraphs Statement +hi def link regoFuncHttp Statement +hi def link regoFuncNet Statement +hi def link regoFuncRego Statement +hi def link regoFuncOpa Statement +hi def link regoFuncDebugging Statement + +" https://www.openpolicyagent.org/docs/latest/policy-language/#strings +syn region regoString start=+"+ skip=+\\\\\|\\"+ end=+"+ +syn region regoRawString start=+`+ end=+`+ + +hi def link regoString String +hi def link regoRawString String + +" Comments; their contents +syn keyword regoTodo contained TODO FIXME XXX BUG +syn cluster regoCommentGroup contains=regoTodo +syn region regoComment start="#" end="$" contains=@regoCommentGroup,@Spell + +hi def link regoComment Comment +hi def link regoTodo Todo + +let b:current_syntax = 'rego' + +endif -- cgit v1.2.3