mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
@@ -2,7 +2,7 @@
|
||||
" Language: C++
|
||||
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
|
||||
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
|
||||
" Last Change: 2017 Jun 05
|
||||
" Last Change: 2019 Dec 18
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -42,6 +42,8 @@ if !exists("cpp_no_cpp11")
|
||||
syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE
|
||||
syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
|
||||
syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*<"me=e-1
|
||||
syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*$"
|
||||
endif
|
||||
|
||||
" C++ 14 extensions
|
||||
@@ -53,6 +55,21 @@ if !exists("cpp_no_cpp14")
|
||||
syn case match
|
||||
endif
|
||||
|
||||
" C++ 20 extensions
|
||||
if !exists("cpp_no_cpp20")
|
||||
syn keyword cppStatement co_await co_return co_yield requires
|
||||
syn keyword cppStorageClass consteval constinit
|
||||
syn keyword cppStructure concept
|
||||
syn keyword cppType char8_t
|
||||
syn keyword cppModule import module export
|
||||
endif
|
||||
|
||||
" C++ 17 extensions
|
||||
if !exists("cpp_no_cpp17")
|
||||
syn match cppCast "\<reinterpret_pointer_cast\s*<"me=e-1
|
||||
syn match cppCast "\<reinterpret_pointer_cast\s*$"
|
||||
endif
|
||||
|
||||
" The minimum and maximum operators in GNU C++
|
||||
syn match cppMinMax "[<>]?"
|
||||
|
||||
@@ -71,6 +88,7 @@ hi def link cppConstant Constant
|
||||
hi def link cppRawStringDelimiter Delimiter
|
||||
hi def link cppRawString String
|
||||
hi def link cppNumber Number
|
||||
hi def link cppModule Include
|
||||
|
||||
let b:current_syntax = "cpp"
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
" Vim syntax file
|
||||
" Language: CVS commit file
|
||||
" Maintainer: Matt Dunford (zoot@zotikos.com)
|
||||
" URL: http://www.zotikos.com/downloads/cvs.vim
|
||||
" Maintainer: Matt Dunford (zenmatic@gmail.com)
|
||||
" Last Change: Sat Nov 24 23:25:11 CET 2001
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
|
||||
89
runtime/syntax/rego.vim
Normal file
89
runtime/syntax/rego.vim
Normal file
@@ -0,0 +1,89 @@
|
||||
" 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 "\<array\.\(concat\|slice\)\>"
|
||||
syn keyword regoFuncSets intersection union
|
||||
|
||||
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
|
||||
syn match regoFuncStrings2 "\<strings\.replace_n\>"
|
||||
syn match regoFuncStrings3 "\<contains\>"
|
||||
|
||||
syn keyword regoFuncRegex re_match
|
||||
syn match regoFuncRegex2 "\<regex\.\(split\|globs_match\|template_match\|find_n\|find_all_string_submatch_n\)\>"
|
||||
|
||||
syn match regoFuncGlob "\<glob\.\(match\|quote_meta\)\>"
|
||||
syn match regoFuncUnits "\<units\.parse_bytes\>"
|
||||
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 "\<urlquery\.\(encode\|decode\|encode_object\)\>"
|
||||
syn match regoFuncEncoding3 "\<\(json\|yaml\)\.\(marshal\|unmarshal\)\>"
|
||||
syn match regoFuncTokenSigning "\<io\.jwt\.\(encode_sign_raw\|encode_sign\)\>"
|
||||
syn match regoFuncTokenVerification "\<io\.jwt\.\(verify_rs256\|verify_ps256\|verify_es256\|verify_hs256\|decode\|decode_verify\)\>"
|
||||
syn match regoFuncTime "\<time\.\(now_ns\|parse_ns\|parse_rfc3339_ns\|parse_duration_ns\|date\|clock\|weekday\)\>"
|
||||
syn match regoFuncCryptography "\<crypto\.x509\.parse_certificates\>"
|
||||
syn keyword regoFuncGraphs walk
|
||||
syn match regoFuncHttp "\<http\.send\>"
|
||||
syn match regoFuncNet "\<net\.\(cidr_contains\|cidr_intersects\)\>"
|
||||
syn match regoFuncRego "\<rego\.parse_module\>"
|
||||
syn match regoFuncOpa "\<opa\.runtime\>"
|
||||
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'
|
||||
Reference in New Issue
Block a user