mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
Perl support (#978)
This commit is contained in:
parent
cdc2107bca
commit
30744646cb
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -134,3 +134,7 @@
|
||||
path = helix-syntax/languages/tree-sitter-cmake
|
||||
url = https://github.com/uyha/tree-sitter-cmake
|
||||
shallow = true
|
||||
[submodule "helix-syntax/languages/tree-sitter-perl"]
|
||||
path = helix-syntax/languages/tree-sitter-perl
|
||||
url = https://github.com/ganezdragon/tree-sitter-perl
|
||||
shallow = true
|
||||
|
1
helix-syntax/languages/tree-sitter-perl
Submodule
1
helix-syntax/languages/tree-sitter-perl
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 0ac2c6da562c7a2c26ed7e8691d4a590f7e8b90a
|
@ -366,3 +366,11 @@ roots = []
|
||||
comment-token = "#"
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
language-server = { command = "cmake-language-server" }
|
||||
|
||||
[[language]]
|
||||
name = "perl"
|
||||
scope = "source.perl"
|
||||
file-types = ["pl", "pm"]
|
||||
roots = []
|
||||
comment-token = "#"
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
|
181
runtime/queries/perl/highlights.scm
Normal file
181
runtime/queries/perl/highlights.scm
Normal file
@ -0,0 +1,181 @@
|
||||
; Variables
|
||||
(variable_declaration
|
||||
.
|
||||
(scope) @keyword)
|
||||
[
|
||||
(single_var_declaration)
|
||||
(scalar_variable)
|
||||
(array_variable)
|
||||
(hash_variable)
|
||||
(hash_variable)
|
||||
] @variable
|
||||
|
||||
|
||||
[
|
||||
(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
|
||||
|
||||
[
|
||||
(use_no_statement)
|
||||
(use_no_feature_statement)
|
||||
(use_no_if_statement)
|
||||
(use_no_version)
|
||||
(use_constant_statement)
|
||||
(use_parent_statement)
|
||||
] @keyword
|
||||
|
||||
(use_constant_statement
|
||||
constant: (identifier) @constant)
|
||||
|
||||
[
|
||||
"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)
|
||||
[
|
||||
(function)
|
||||
(map)
|
||||
(grep)
|
||||
(bless)
|
||||
] @function
|
||||
|
||||
[
|
||||
"return"
|
||||
"sub"
|
||||
"package"
|
||||
"BEGIN"
|
||||
"END"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
(standard_input_to_variable) @punctuation.bracket
|
||||
|
||||
[
|
||||
"=~"
|
||||
"or"
|
||||
"="
|
||||
"=="
|
||||
"+"
|
||||
"-"
|
||||
"."
|
||||
"//"
|
||||
"||"
|
||||
(arrow_operator)
|
||||
(hash_arrow_operator)
|
||||
(array_dereference)
|
||||
(hash_dereference)
|
||||
(to_reference)
|
||||
(type_glob)
|
||||
(hash_access_variable)
|
||||
(ternary_expression)
|
||||
(ternary_expression_in_hash)
|
||||
] @operator
|
||||
|
||||
[
|
||||
(regex_option)
|
||||
(regex_option_for_substitution)
|
||||
(regex_option_for_transliteration)
|
||||
] @variable.parameter
|
||||
|
||||
(type_glob
|
||||
(identifier) @variable)
|
||||
(
|
||||
(scalar_variable)
|
||||
.
|
||||
("->" @operator))
|
||||
|
||||
[
|
||||
(word_list_qw)
|
||||
(command_qx_quoted)
|
||||
(string_single_quoted)
|
||||
(string_double_quoted)
|
||||
(string_qq_quoted)
|
||||
(bareword)
|
||||
(transliteration_tr_or_y)
|
||||
] @string
|
||||
|
||||
[
|
||||
(regex_pattern_qr)
|
||||
(patter_matcher_m)
|
||||
(substitution_pattern_s)
|
||||
] @string.regexp
|
||||
|
||||
(escape_sequence) @string.special
|
||||
|
||||
[
|
||||
","
|
||||
(semi_colon)
|
||||
(start_delimiter)
|
||||
(end_delimiter)
|
||||
(ellipsis_statement)
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
(integer)
|
||||
(floating_point)
|
||||
(scientific_notation)
|
||||
(hexadecimal)
|
||||
] @constant.numeric
|
||||
|
||||
[
|
||||
; (if_statement)
|
||||
(unless_statement)
|
||||
(if_simple_statement)
|
||||
(unless_simple_statement)
|
||||
] @keyword.control.conditional
|
||||
|
||||
[
|
||||
"if"
|
||||
"elsif"
|
||||
"else"
|
||||
] @keyword.control.conditional
|
||||
|
||||
(foreach_statement) @keyword.control.repeat
|
||||
(foreach_statement
|
||||
.
|
||||
(scope) @keyword)
|
||||
|
||||
(function_attribute) @label
|
||||
|
||||
(function_signature) @type
|
||||
|
8
runtime/queries/perl/textobjects.scm
Normal file
8
runtime/queries/perl/textobjects.scm
Normal file
@ -0,0 +1,8 @@
|
||||
(function_definition
|
||||
(identifier) (_) @function.inside) @function.around
|
||||
|
||||
(anonymous_function
|
||||
(_) @function.inside) @function.around
|
||||
|
||||
(argument
|
||||
(_) @parameter.inside)
|
Loading…
Reference in New Issue
Block a user