Skip to content

Commit

Permalink
enh(perl) fix false-positive variable match at end of string
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Dec 2, 2023
1 parent a832789 commit f8685cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Core Grammars:

- enh(perl) fix false-positive variable match at end of string
- fix(cpp) not all kinds of number literals are highlighted correctly [Lê Duy Quang][]
- fix(css) fix overly greedy pseudo class matching [Bradley Mackey][]
- enh(arcade) updated to ArcGIS Arcade version 1.24 [Kristian Ekenes][]
Expand All @@ -22,6 +23,7 @@ Developer Tool:
- enh(tools): order CSS options picklist [David Schach][]
- enh(tools): remove duplicate CSS options [David Schach][]

[Josh Goebel]: https://github.com/joshgoebel
[Lê Duy Quang]: https://github.com/leduyquang753
[Mohamed Ali]: https://github.com/MohamedAli00949
[Bradley Mackey]: https://github.com/bradleymackey
Expand Down
4 changes: 2 additions & 2 deletions src/languages/perl.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ export default function(hljs) {
variants: [
{ begin: /\$\d/ },
{ begin: regex.concat(
/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,
/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,
// negative look-ahead tries to avoid matching patterns that are not
// Perl at all like $ident$, @ident@, etc.
`(?![A-Za-z])(?![@$%])`
)
},
{
// Only $= is a special Perl variable and one can't declare @= or %=.
begin: /[$%@][^\s\w{=]|\$=/,
begin: /[$%@](?!")[^\s\w{=]|\$=/,
relevance: 0
}
],
Expand Down

0 comments on commit f8685cf

Please sign in to comment.