Treat perl regexes as atoms too

pull/281/head
Wilfred Hughes 2022-04-29 18:27:42 +07:00
parent 3bb5933163
commit 03c5d78650
5 changed files with 14 additions and 5 deletions

@ -5,7 +5,7 @@
Improved detection of binary files that have a large number of null
bytes.
Improved handling of comments in Perl.
Improved handling of comments and regexp literals in Perl.
## 0.28 (released 29th April 2022)

@ -110,7 +110,7 @@ sample_files/outer_delimiter_before.el sample_files/outer_delimiter_after.el
73130b8572a4f17fa6cf828f74e226ce -
sample_files/perl_before.pl sample_files/perl_after.pl
08d7cad58a79d423c0584387d4bb4dd1 -
ae10c90122289e0f4298c1b962a74c2e -
sample_files/preprocesor_before.h sample_files/preprocesor_after.h
3e4331cb935cbe735a79ebc43786cd3a -

@ -36,3 +36,5 @@ foreach my $key (woof()) {
use constant WEEKDAYS => qw(
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
);
$f =~ s/foo/abc/g;

@ -23,3 +23,5 @@ use constant {
use constant WEEKDAYS => qw(
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
);
$f =~ s/foo/bar/g;

@ -502,9 +502,14 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
TreeSitterConfig {
name: "Perl",
language,
atom_nodes: vec!["string_single_quoted", "string_double_quoted", "comments"]
.into_iter()
.collect(),
atom_nodes: vec![
"string_single_quoted",
"string_double_quoted",
"comments",
"substitution_pattern_s",
]
.into_iter()
.collect(),
delimiter_tokens: vec![("(", ")"), ("{", "}"), ("[", "]")],
highlight_query: ts::Query::new(
language,