on master help sign in
switch to https://github.com/tree-sitter-perl/tree-sitter-perl (#7644)
commite7f60611acbfc6b22867240a166fcb7169843ee0 authorJesse Luehrs <doy@tozt.net> dateMon 17 Jul 2023, 01:09 (3 years ago) parentad2061b
7 files changed+96−190
book/src/generated/lang-support.md+1−1 languages.toml+1−1 runtime/queries/perl/fold.scm+19 runtime/queries/perl/highlights.scm+74−155 runtime/queries/perl/indents.scm−15 runtime/queries/perl/injections.scm+1−1 runtime/queries/perl/textobjects.scm−17
book/src/generated/lang-support.md+1−1
@@ -109,7 +109,7 @@
109109| pascal | ✓ | ✓ | | `pasls` |
110110| passwd | ✓ | | | |
111111| pem | ✓ | | | |
112−| perl | ✓ | ✓ | ✓ | `perlnavigator` |
112+| perl | ✓ | | | `perlnavigator` |
113113| php | ✓ | ✓ | ✓ | `intelephense` |
114114| po | ✓ | ✓ | | |
115115| ponylang | ✓ | ✓ | ✓ | |
languages.toml+1−1
@@ -1112,7 +1112,7 @@ indent = { tab-width = 2, unit = " " }
11121112
11131113[[grammar]]
11141114name = "perl"
1115−source = { git = "https://github.com/ganezdragon/tree-sitter-perl", rev = "0ac2c6da562c7a2c26ed7e8691d4a590f7e8b90a" }
1115+source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "ed21ecbcc128a6688770ebafd3ef68a1c9bc1ea9" }
11161116
11171117[[language]]
11181118name = "racket"
runtime/queries/perl/fold.scmnew file+19
@@ -0,0 +1,19 @@
1+(comment) @fold
2+(pod) @fold
3+
4+; fold the block-typed package statements only
5+(package_statement (block)) @fold
6+
7+[(subroutine_declaration_statement)
8+ (conditional_statement)
9+ (loop_statement)
10+ (for_statement)
11+ (cstyle_for_statement)
12+ (block_statement)
13+ (phaser_statement)] @fold
14+
15+(anonymous_subroutine_expression) @fold
16+
17+; perhaps folks want to fold these too?
18+[(anonymous_array_expression)
19+ (anonymous_hash_expression)] @fold
runtime/queries/perl/highlights.scm+74−155
@@ -1,181 +1,100 @@
1−; Variables
2−(variable_declaration
3− .
4− (scope) @keyword)
51[
6−(single_var_declaration)
7−(scalar_variable)
8−(array_variable)
9−(hash_variable)
10−(hash_variable)
11−] @variable
12−
2+ "use" "no" "require" "package"
3+] @keyword.control.import
134
145[
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
6+ "sub"
7+] @keyword.function
348
359[
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)
10+ "if" "elsif" "else" "unless"
11+] @keyword.control.conditional
4612
4713[
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
14+ "while" "until"
15+ "for" "foreach"
16+ "do"
17+] @keyword.control.repeat
7418
7519[
76−"return"
77−"sub"
78−"package"
79−"BEGIN"
80−"END"
81−] @keyword.function
20+ "my" "our" "local"
21+] @keyword.storage.modifier
8222
8323[
84−"("
85−")"
86−"["
87−"]"
88−"{"
89−"}"
90−] @punctuation.bracket
91−(standard_input_to_variable) @punctuation.bracket
24+ "last" "next" "redo" "goto" "return"
25+] @keyword.control.return
9226
9327[
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
28+ "undef"
29+] @constant.builtin
11330
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))
31+(phaser_statement phase: _ @keyword.directive)
12632
12733[
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
34+ "or" "and"
35+ "eq" "ne" "cmp" "lt" "le" "ge" "gt"
36+ "isa"
37+] @keyword.operator
13638
137−[
138−(regex_pattern_qr)
139−(patter_matcher_m)
140−(substitution_pattern_s)
141−] @string.regexp
39+(comment) @comment
14240
143−(escape_sequence) @string.special
41+(eof_marker) @keyword.directive
42+(data_section) @comment
14443
145−[
146−","
147−(semi_colon)
148−(start_delimiter)
149−(end_delimiter)
150−(ellipsis_statement)
151−] @punctuation.delimiter
44+(pod) @comment.block.documentation
15245
153−[
154−(integer)
155−(floating_point)
156−(scientific_notation)
157−(hexadecimal)
158−] @constant.numeric
46+(number) @constant.numeric
47+(version) @constant
15948
160−[
161−; (if_statement)
162−(unless_statement)
163−(if_simple_statement)
164−(unless_simple_statement)
165−] @keyword.control.conditional
49+(string_literal) @string
50+(interpolated_string_literal) @string
51+(quoted_word_list) @string
52+(command_string) @string
53+[(heredoc_token) (command_heredoc_token)] @string.special
54+(heredoc_content) @string
55+(heredoc_end) @string.special
56+[(escape_sequence) (escaped_delimiter)] @constant.character.escape
16657
167−[
168−"if"
169−"elsif"
170−"else"
171−] @keyword.control.conditional
58+[(quoted_regexp) (match_regexp)] @string.regexp
59+
60+(autoquoted_bareword _?) @string.special
61+
62+[(scalar) (arraylen)] @variable
63+(scalar_deref_expression ["->" "$" "*"] @variable)
64+(array) @variable
65+(array_deref_expression ["->" "@" "*"] @variable)
66+(hash) @variable
67+(hash_deref_expression ["->" "%" "*"] @variable)
68+
69+(array_element_expression [array:(_) "->" "[" "]"] @variable)
70+(slice_expression [array:(_) "->" "[" "]"] @variable)
71+(keyval_expression [array:(_) "->" "[" "]"] @variable)
72+
73+(hash_element_expression [hash:(_) "->" "{" "}"] @variable)
74+(slice_expression [hash:(_) "->" "[" "]"] @variable)
75+(keyval_expression [hash:(_) "->" "[" "]"] @variable)
76+
77+(hash_element_expression key: (bareword) @string.special)
78+
79+(use_statement (package) @type)
80+(package_statement (package) @type)
81+(require_expression (bareword) @type)
82+
83+(subroutine_declaration_statement name: (_) @function)
84+(attrlist (attribute) @attribute)
85+
86+(goto_expression (label) @label)
87+(loopex_expression (label) @label)
88+
89+(statement_label label: _ @label)
17290
173−(foreach_statement) @keyword.control.repeat
174−(foreach_statement
175− .
176− (scope) @keyword)
91+(relational_expression operator: "isa" right: (bareword) @type)
17792
178−(function_attribute) @label
93+(function_call_expression (function) @function)
94+(method_call_expression (method) @function.method)
95+(method_call_expression invocant: (bareword) @type)
17996
180−(function_signature) @type
97+(func0op_call_expression function: _ @function.builtin)
98+(func1op_call_expression function: _ @function.builtin)
18199
100+(function) @function
runtime/queries/perl/indents.scmdeleted−15
@@ -1,15 +0,0 @@
1−[
2− (function)
3− (identifier)
4− (method_invocation)
5− (if_statement)
6− (unless_statement)
7− (if_simple_statement)
8− (unless_simple_statement)
9− (variable_declaration)
10− (block)
11− (list_item)
12− (word_list_qw)
13−] @indent
14−
15−"}" @outdent
runtime/queries/perl/injections.scm+1−1
@@ -1,2 +1,2 @@
1−((comments) @injection.content
1+((comment) @injection.content
22 (#set! injection.language "comment"))
runtime/queries/perl/textobjects.scmdeleted−17
@@ -1,17 +0,0 @@
1−(function_definition
2− (identifier) (_) @function.inside) @function.around
3−
4−(anonymous_function
5− (_) @function.inside) @function.around
6−
7−(argument
8− (_) @parameter.inside)
9−
10−[
11− (comments)
12− (pod_statement)
13−] @comment.inside
14−
15−(comments)+ @comment.around
16−
17−(pod_statement) @comment.around