rego: update parser and queries (#3805)

Co-authored-by: Oleksii Demennikov <odemennikov@lohika.com>
This commit is contained in:
FallenAngel97 2022-11-16 10:35:41 +02:00 committed by GitHub
parent 2072692aaa
commit 34807c605a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 12 deletions

View file

@ -297,7 +297,7 @@
"revision": "e1cfca3c79896ff79842f057ea13e529b66af636"
},
"rego": {
"revision": "6d70da3a998fd0081efc5d1019c71e74cc1568e9"
"revision": "8778c41757e2ae6738d64da114ea23868dedf349"
},
"rnoweb": {
"revision": "502c1126dc6777f09af5bef16e72a42f75bd081e"

View file

@ -1,16 +1,64 @@
; highlights.scm
"import" @include
"package" @include
[
(import)
(package)
] @include
[
(with)
(as)
(every)
(some)
(in)
(not)
(if)
(contains)
(else)
(default)
"null"
] @keyword
[
"true"
"false"
] @boolean
[
(assignment_operator)
(bool_operator)
(arith_operator)
(bin_operator)
] @operator
[
(string)
(raw_string)
] @string
(term (ref (var))) @variable
(reserved_keywords) @keyword
(comment) @comment
(rego_block rego_rule_name: (identifier) @function)
(builtin_function function_name: (function_name) @function.builtin)
(opening_parameter) @punctuation.bracket
(closing_parameter) @punctuation.bracket
(string_definition) @string
(number) @number
(operator) @operator
(true) @boolean
(false) @boolean
(expr_call func_name: (fn_name (var) @function .))
(expr_call func_arguments: (fn_args (expr) @parameter))
(rule_args (term) @parameter)
[
(open_paren)
(close_paren)
(open_bracket)
(close_bracket)
(open_curly)
(close_curly)
] @punctuation.bracket
(rule (rule_head (var) @method))
(rule
(rule_head (term (ref (var) @namespace)))
(rule_body (query (literal (expr (expr_infix (expr (term (ref (var)) @_output)))))) (#eq? @_output @namespace))
)