Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/perl/highlights.scm')
| -rw-r--r-- | runtime/queries/perl/highlights.scm | 228 |
1 files changed, 155 insertions, 73 deletions
diff --git a/runtime/queries/perl/highlights.scm b/runtime/queries/perl/highlights.scm index 5f224333..b6f04291 100644 --- a/runtime/queries/perl/highlights.scm +++ b/runtime/queries/perl/highlights.scm @@ -1,99 +1,181 @@ +; Variables +(variable_declaration + . + (scope) @keyword) [ - "use" "no" "require" "package" "class" "role" -] @keyword.control.import +(single_var_declaration) +(scalar_variable) +(array_variable) +(hash_variable) +(hash_variable) +] @variable -[ - "sub" "method" "async" "extended" -] @keyword.function [ - "if" "elsif" "else" "unless" -] @keyword.control.conditional +(package_name) +(special_scalar_variable) +(special_array_variable) +(special_hash_variable) +(special_literal) +(super) +] @constant + +( + [ + (package_name) + (super) + ] + . + ("::" @operator) +) + +(comments) @comment +(pod_statement) @comment.block.documentation [ - "while" "until" - "for" "foreach" - "do" -] @keyword.control.repeat +(use_no_statement) +(use_no_feature_statement) +(use_no_if_statement) +(use_no_version) +(use_constant_statement) +(use_parent_statement) +] @keyword -[ - "my" "our" "local" "state" -] @keyword.storage.modifier +(use_constant_statement + constant: (identifier) @constant) [ - "last" "next" "redo" "goto" "return" -] @keyword.control.return - +"require" +] @keyword + +(method_invocation + . + (identifier) @variable) + +(method_invocation + (arrow_operator) + . + (identifier) @function) +(method_invocation + function_name: (identifier) @function) +(named_block_statement + function_name: (identifier) @function) + +(call_expression + function_name: (identifier) @function) +(function_definition + name: (identifier) @function) [ - "undef" -] @constant.builtin - -(phaser_statement phase: _ @keyword.directive) -(class_phaser_statement phase: _ @keyword.directive) +(function) +(map) +(grep) +(bless) +] @function [ - "or" "xor" "and" - "eq" "ne" "cmp" "lt" "le" "ge" "gt" - "isa" -] @keyword.operator - -(comment) @comment - -(function) @function - -(eof_marker) @keyword.directive -(data_section) @comment - -(number) @constant.numeric -(version) @constant +"return" +"sub" +"package" +"BEGIN" +"END" +] @keyword.function -(string_literal) @string -(interpolated_string_literal) @string -(quoted_word_list) @string -(command_string) @string -[(heredoc_token) (command_heredoc_token)] @string.special -(heredoc_content) @string -(heredoc_end) @string.special -[(escape_sequence) (escaped_delimiter)] @constant.character.escape +[ +"(" +")" +"[" +"]" +"{" +"}" +] @punctuation.bracket +(standard_input_to_variable) @punctuation.bracket -[(quoted_regexp) (match_regexp)] @string.regexp +[ +"=~" +"or" +"=" +"==" +"+" +"-" +"." +"//" +"||" +(arrow_operator) +(hash_arrow_operator) +(array_dereference) +(hash_dereference) +(to_reference) +(type_glob) +(hash_access_variable) +(ternary_expression) +(ternary_expression_in_hash) +] @operator -(autoquoted_bareword) @string.special +[ +(regex_option) +(regex_option_for_substitution) +(regex_option_for_transliteration) +] @variable.parameter + +(type_glob + (identifier) @variable) +( + (scalar_variable) + . + ("->" @operator)) -[(scalar) (arraylen)] @variable -(scalar_deref_expression ["->" "$" "*"] @variable) -(array) @variable -(array_deref_expression ["->" "@" "*"] @variable) -(hash) @variable -(hash_deref_expression ["->" "%" "*"] @variable) +[ +(word_list_qw) +(command_qx_quoted) +(string_single_quoted) +(string_double_quoted) +(string_qq_quoted) +(bareword) +(transliteration_tr_or_y) +] @string -(array_element_expression [array:(_) "->" "[" "]"] @variable) -(slice_expression [array:(_) "->" "[" "]"] @variable) -(keyval_expression [array:(_) "->" "[" "]"] @variable) +[ +(regex_pattern_qr) +(patter_matcher_m) +(substitution_pattern_s) +] @string.regexp -(hash_element_expression [hash:(_) "->" "{" "}"] @variable) -(slice_expression [hash:(_) "->" "[" "]"] @variable) -(keyval_expression [hash:(_) "->" "[" "]"] @variable) +(escape_sequence) @string.special -(hash_element_expression key: (bareword) @string.special) +[ +"," +(semi_colon) +(start_delimiter) +(end_delimiter) +(ellipsis_statement) +] @punctuation.delimiter -(use_statement (package) @type) -(package_statement (package) @type) -(require_expression (bareword) @type) +[ +(integer) +(floating_point) +(scientific_notation) +(hexadecimal) +] @constant.numeric -(subroutine_declaration_statement name: (_) @function) -(attrlist (attribute) @attribute) +[ +; (if_statement) +(unless_statement) +(if_simple_statement) +(unless_simple_statement) +] @keyword.control.conditional -(goto_expression (label) @label) -(loopex_expression (label) @label) +[ +"if" +"elsif" +"else" +] @keyword.control.conditional -(statement_label label: _ @label) +(foreach_statement) @keyword.control.repeat +(foreach_statement + . + (scope) @keyword) -(relational_expression operator: "isa" right: (bareword) @type) +(function_attribute) @label -(function_call_expression (function) @function) -(method_call_expression (method) @function.method) -(method_call_expression invocant: (bareword) @type) +(function_signature) @type -(func0op_call_expression function: _ @function.builtin) -(func1op_call_expression function: _ @function.builtin) |