summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/src/generated/lang-support.md2
-rw-r--r--languages.toml2
-rw-r--r--runtime/queries/perl/indents.scm29
-rw-r--r--runtime/queries/perl/textobjects.scm14
4 files changed, 45 insertions, 2 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 596b62ba..c1b0acfd 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -112,7 +112,7 @@
| pascal | ✓ | ✓ | | `pasls` |
| passwd | ✓ | | | |
| pem | ✓ | | | |
-| perl | ✓ | | | `perlnavigator` |
+| perl | ✓ | ✓ | ✓ | `perlnavigator` |
| php | ✓ | ✓ | ✓ | `intelephense` |
| po | ✓ | ✓ | | |
| pod | ✓ | | | |
diff --git a/languages.toml b/languages.toml
index 3e3c5a5a..4d1e6fe0 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1119,7 +1119,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "perl"
-source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "ed21ecbcc128a6688770ebafd3ef68a1c9bc1ea9" }
+source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "9f3166800d40267fa68ed8273e96baf74f390517" }
[[language]]
name = "pod"
diff --git a/runtime/queries/perl/indents.scm b/runtime/queries/perl/indents.scm
new file mode 100644
index 00000000..03318243
--- /dev/null
+++ b/runtime/queries/perl/indents.scm
@@ -0,0 +1,29 @@
+[
+ (block)
+ (conditional_statement)
+ (loop_statement)
+ (cstyle_for_statement)
+ (for_statement)
+ (elsif)
+ (array_element_expression)
+ (hash_element_expression)
+ (coderef_call_expression)
+ (anonymous_slice_expression)
+ (slice_expression)
+ (keyval_expression)
+ (anonymous_array_expression)
+ (anonymous_hash_expression)
+ (stub_expression)
+ (func0op_call_expression)
+ (func1op_call_expression)
+ (map_grep_expression)
+ (function_call_expression)
+ (method_call_expression)
+ (attribute)
+] @indent
+
+[
+ "}"
+ "]"
+ ")"
+] @outdent
diff --git a/runtime/queries/perl/textobjects.scm b/runtime/queries/perl/textobjects.scm
new file mode 100644
index 00000000..1b0b5f07
--- /dev/null
+++ b/runtime/queries/perl/textobjects.scm
@@ -0,0 +1,14 @@
+(subroutine_declaration_statement
+ body: (_) @function.inside) @function.around
+(anonymous_subroutine_expression
+ body: (_) @function.inside) @function.around
+
+(package_statement) @class.around
+(package_statement
+ (block) @class.inside)
+
+(list_expression
+ (_) @parameter.inside)
+
+(comment) @comment.around
+(pod) @comment.around