feat(perl): improve highlights

This commit is contained in:
ObserverOfTime 2023-08-03 13:49:22 +03:00
parent 1e5576fa01
commit 131f665f90

View file

@ -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,22 +118,16 @@
(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
[ [
"=~" "=~"
@ -137,6 +139,8 @@
"." "."
"//" "//"
"||" "||"
"&&"
"<<"
(arrow_operator) (arrow_operator)
(hash_arrow_operator) (hash_arrow_operator)
(array_dereference) (array_dereference)
@ -165,6 +169,13 @@
(transliteration_tr_or_y) (transliteration_tr_or_y)
] @string ] @string
[
(heredoc_start_identifier)
(heredoc_end_identifier)
] @label
(heredoc_body_statement) @text.literal
[ [
(pattern_matcher) (pattern_matcher)
(regex_pattern_qr) (regex_pattern_qr)