mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 19:00:02 -04:00
feat(perl): improve highlights
This commit is contained in:
parent
1e5576fa01
commit
131f665f90
1 changed files with 70 additions and 59 deletions
|
|
@ -30,15 +30,6 @@
|
||||||
; Keywords to define a function
|
; Keywords to define a function
|
||||||
[ "sub" ] @keyword.function
|
[ "sub" ] @keyword.function
|
||||||
|
|
||||||
; Lots of builtin functions, except tree-sitter-perl doesn't emit most of
|
|
||||||
; these yet
|
|
||||||
;[
|
|
||||||
; "print" "printf" "sprintf" "say"
|
|
||||||
; "push" "pop" "shift" "unshift" "splice"
|
|
||||||
; "exists" "delete" "keys" "values"
|
|
||||||
; "each"
|
|
||||||
;] @function.builtin
|
|
||||||
|
|
||||||
; Keywords that are regular infix operators
|
; Keywords that are regular infix operators
|
||||||
[
|
[
|
||||||
"and" "or" "not" "xor"
|
"and" "or" "not" "xor"
|
||||||
|
|
@ -61,6 +52,9 @@
|
||||||
(super)
|
(super)
|
||||||
] @variable.builtin
|
] @variable.builtin
|
||||||
|
|
||||||
|
((scalar_variable) @variable.builtin
|
||||||
|
(#eq? @variable.builtin "$#ARGV"))
|
||||||
|
|
||||||
; Integer numbers
|
; Integer numbers
|
||||||
[
|
[
|
||||||
(integer)
|
(integer)
|
||||||
|
|
@ -84,8 +78,7 @@
|
||||||
(super) @namespace
|
(super) @namespace
|
||||||
|
|
||||||
; Comments are comments
|
; Comments are comments
|
||||||
(comments) @comment
|
(comments) @comment @spell
|
||||||
(comments) @spell
|
|
||||||
|
|
||||||
((source_file . (comments) @preproc)
|
((source_file . (comments) @preproc)
|
||||||
(#lua-match? @preproc "^#!/"))
|
(#lua-match? @preproc "^#!/"))
|
||||||
|
|
@ -99,6 +92,21 @@
|
||||||
(call_expression
|
(call_expression
|
||||||
function_name: (identifier) @function.call)
|
function_name: (identifier) @function.call)
|
||||||
|
|
||||||
|
; Built-in functions
|
||||||
|
((call_expression
|
||||||
|
function_name: (identifier) @function.builtin)
|
||||||
|
(#any-of? @function.builtin
|
||||||
|
"print" "printf" "sprintf" "say"
|
||||||
|
"push" "pop" "shift" "unshift" "splice"
|
||||||
|
"exists" "delete" "keys" "values"
|
||||||
|
"each"))
|
||||||
|
|
||||||
|
[
|
||||||
|
(map)
|
||||||
|
(grep)
|
||||||
|
(bless)
|
||||||
|
] @function.builtin
|
||||||
|
|
||||||
;; ----------
|
;; ----------
|
||||||
|
|
||||||
(use_constant_statement
|
(use_constant_statement
|
||||||
|
|
@ -110,76 +118,79 @@
|
||||||
(function_definition
|
(function_definition
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
[
|
(function) @function
|
||||||
(function)
|
|
||||||
(map)
|
|
||||||
(grep)
|
|
||||||
(bless)
|
|
||||||
] @function
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"(" ")"
|
||||||
")"
|
"[" "]"
|
||||||
"["
|
"{" "}"
|
||||||
"]"
|
(standard_input_to_variable)
|
||||||
"{"
|
|
||||||
"}"
|
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
(standard_input_to_variable) @punctuation.bracket
|
|
||||||
|
[ "`" "\"" ] @punctuation.special
|
||||||
|
|
||||||
[
|
[
|
||||||
"=~"
|
"=~"
|
||||||
"!~"
|
"!~"
|
||||||
"="
|
"="
|
||||||
"=="
|
"=="
|
||||||
"+"
|
"+"
|
||||||
"-"
|
"-"
|
||||||
"."
|
"."
|
||||||
"//"
|
"//"
|
||||||
"||"
|
"||"
|
||||||
(arrow_operator)
|
"&&"
|
||||||
(hash_arrow_operator)
|
"<<"
|
||||||
(array_dereference)
|
(arrow_operator)
|
||||||
(hash_dereference)
|
(hash_arrow_operator)
|
||||||
(to_reference)
|
(array_dereference)
|
||||||
(type_glob)
|
(hash_dereference)
|
||||||
(hash_access_variable)
|
(to_reference)
|
||||||
|
(type_glob)
|
||||||
|
(hash_access_variable)
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
[
|
[
|
||||||
(regex_option)
|
(regex_option)
|
||||||
(regex_option_for_substitution)
|
(regex_option_for_substitution)
|
||||||
(regex_option_for_transliteration)
|
(regex_option_for_transliteration)
|
||||||
] @parameter
|
] @parameter
|
||||||
|
|
||||||
(type_glob
|
(type_glob
|
||||||
(identifier) @variable)
|
(identifier) @variable)
|
||||||
|
|
||||||
[
|
[
|
||||||
(word_list_qw)
|
(word_list_qw)
|
||||||
(command_qx_quoted)
|
(command_qx_quoted)
|
||||||
(string_single_quoted)
|
(string_single_quoted)
|
||||||
(string_double_quoted)
|
(string_double_quoted)
|
||||||
(string_qq_quoted)
|
(string_qq_quoted)
|
||||||
(bareword)
|
(bareword)
|
||||||
(transliteration_tr_or_y)
|
(transliteration_tr_or_y)
|
||||||
] @string
|
] @string
|
||||||
|
|
||||||
[
|
[
|
||||||
(pattern_matcher)
|
(heredoc_start_identifier)
|
||||||
(regex_pattern_qr)
|
(heredoc_end_identifier)
|
||||||
(patter_matcher_m)
|
] @label
|
||||||
(substitution_pattern_s)
|
|
||||||
|
(heredoc_body_statement) @text.literal
|
||||||
|
|
||||||
|
[
|
||||||
|
(pattern_matcher)
|
||||||
|
(regex_pattern_qr)
|
||||||
|
(patter_matcher_m)
|
||||||
|
(substitution_pattern_s)
|
||||||
] @string.regex
|
] @string.regex
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
[
|
[
|
||||||
","
|
","
|
||||||
(semi_colon)
|
(semi_colon)
|
||||||
(start_delimiter)
|
(start_delimiter)
|
||||||
(end_delimiter)
|
(end_delimiter)
|
||||||
(ellipsis_statement)
|
(ellipsis_statement)
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
(function_attribute) @field
|
(function_attribute) @field
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue