on master help sign in
Perl support (#978)
commit30744646cb0fab64a87f20c98bff033007512323 authorath3 <45574139+ath3@users.noreply.github.com> dateMon 8 Nov 2021, 02:05 (5 years ago) parentcdc2107
5 files changed+202
.gitmodules+4 helix-syntax/languages/tree-sitter-perl+1 languages.toml+8 runtime/queries/perl/highlights.scm+181 runtime/queries/perl/textobjects.scm+8
.gitmodules+4
@@ -134,3 +134,7 @@
134134 path = helix-syntax/languages/tree-sitter-cmake
135135 url = https://github.com/uyha/tree-sitter-cmake
136136 shallow = true
137+[submodule "helix-syntax/languages/tree-sitter-perl"]
138+ path = helix-syntax/languages/tree-sitter-perl
139+ url = https://github.com/ganezdragon/tree-sitter-perl
140+ shallow = true
helix-syntax/languages/tree-sitter-perlnew file+1

Submodule changed.

languages.toml+8
@@ -366,3 +366,11 @@ roots = []
366366comment-token = "#"
367367indent = { tab-width = 2, unit = " " }
368368language-server = { command = "cmake-language-server" }
369+
370+[[language]]
371+name = "perl"
372+scope = "source.perl"
373+file-types = ["pl", "pm"]
374+roots = []
375+comment-token = "#"
376+indent = { tab-width = 2, unit = " " }
runtime/queries/perl/highlights.scmnew file+181
@@ -0,0 +1,181 @@
1+; Variables
2+(variable_declaration
3+ .
4+ (scope) @keyword)
5+[
6+(single_var_declaration)
7+(scalar_variable)
8+(array_variable)
9+(hash_variable)
10+(hash_variable)
11+] @variable
12+
13+
14+[
15+(package_name)
16+(special_scalar_variable)
17+(special_array_variable)
18+(special_hash_variable)
19+(special_literal)
20+(super)
21+] @constant
22+
23+(
24+ [
25+ (package_name)
26+ (super)
27+ ]
28+ .
29+ ("::" @operator)
30+)
31+
32+(comments) @comment
33+(pod_statement) @comment.block.documentation
34+
35+[
36+(use_no_statement)
37+(use_no_feature_statement)
38+(use_no_if_statement)
39+(use_no_version)
40+(use_constant_statement)
41+(use_parent_statement)
42+] @keyword
43+
44+(use_constant_statement
45+ constant: (identifier) @constant)
46+
47+[
48+"require"
49+] @keyword
50+
51+(method_invocation
52+ .
53+ (identifier) @variable)
54+
55+(method_invocation
56+ (arrow_operator)
57+ .
58+ (identifier) @function)
59+(method_invocation
60+ function_name: (identifier) @function)
61+(named_block_statement
62+ function_name: (identifier) @function)
63+
64+(call_expression
65+ function_name: (identifier) @function)
66+(function_definition
67+ name: (identifier) @function)
68+[
69+(function)
70+(map)
71+(grep)
72+(bless)
73+] @function
74+
75+[
76+"return"
77+"sub"
78+"package"
79+"BEGIN"
80+"END"
81+] @keyword.function
82+
83+[
84+"("
85+")"
86+"["
87+"]"
88+"{"
89+"}"
90+] @punctuation.bracket
91+(standard_input_to_variable) @punctuation.bracket
92+
93+[
94+"=~"
95+"or"
96+"="
97+"=="
98+"+"
99+"-"
100+"."
101+"//"
102+"||"
103+(arrow_operator)
104+(hash_arrow_operator)
105+(array_dereference)
106+(hash_dereference)
107+(to_reference)
108+(type_glob)
109+(hash_access_variable)
110+(ternary_expression)
111+(ternary_expression_in_hash)
112+] @operator
113+
114+[
115+(regex_option)
116+(regex_option_for_substitution)
117+(regex_option_for_transliteration)
118+] @variable.parameter
119+
120+(type_glob
121+ (identifier) @variable)
122+(
123+ (scalar_variable)
124+ .
125+ ("->" @operator))
126+
127+[
128+(word_list_qw)
129+(command_qx_quoted)
130+(string_single_quoted)
131+(string_double_quoted)
132+(string_qq_quoted)
133+(bareword)
134+(transliteration_tr_or_y)
135+] @string
136+
137+[
138+(regex_pattern_qr)
139+(patter_matcher_m)
140+(substitution_pattern_s)
141+] @string.regexp
142+
143+(escape_sequence) @string.special
144+
145+[
146+","
147+(semi_colon)
148+(start_delimiter)
149+(end_delimiter)
150+(ellipsis_statement)
151+] @punctuation.delimiter
152+
153+[
154+(integer)
155+(floating_point)
156+(scientific_notation)
157+(hexadecimal)
158+] @constant.numeric
159+
160+[
161+; (if_statement)
162+(unless_statement)
163+(if_simple_statement)
164+(unless_simple_statement)
165+] @keyword.control.conditional
166+
167+[
168+"if"
169+"elsif"
170+"else"
171+] @keyword.control.conditional
172+
173+(foreach_statement) @keyword.control.repeat
174+(foreach_statement
175+ .
176+ (scope) @keyword)
177+
178+(function_attribute) @label
179+
180+(function_signature) @type
181+
runtime/queries/perl/textobjects.scmnew file+8
@@ -0,0 +1,8 @@
1+(function_definition
2+ (identifier) (_) @function.inside) @function.around
3+
4+(anonymous_function
5+ (_) @function.inside) @function.around
6+
7+(argument
8+ (_) @parameter.inside)