Skip to content
Commit d0c69819 authored by Nibaldo González's avatar Nibaldo González
Browse files

Perl: fix brackets, variables, string references and others

Summary:
### Fix incorrect bracket closures in RegExp patterns

BUG: 364866

Recursive subgroups are added inside brackets `{}` and `()`, to avoid incorrect closures in RegExp patterns. This correction is in accordance with other text editors (VS Code, Atom, gedit & Sublime Text), which highlight the RegExp patterns in that way.
{F6247870}

### Allow strings as scalar references

BUG: 348765

Previously, the characters `"` and `'` were escaped, which caused an erroneous highlight when using references such as `\'string'` (see ref. [1] and [2]).
{F6247874}

### Fix incorrect highlighting of variables that start with underscores

BUG: 355300

This error was caused by the order of the RegExpr rules to detect variables: `[@\$][\+\-_]` had priority over `\$[#_][\w_]` (`$_` is a special variable) (ref. [3] & [4]).
{F6247872}

### Fix incorrect highlighting of characters in variables

BUG: 391577

Previously, characters such as `()[]}` were highlighted after `*` in some variables, such as `@*)`, causing incorrect closures of brackets.
{F6247871}

### Other fixes:

* Add variables with carret, such as: `${^Foo}` or `$^V` (ref. [3]).
* Add special variables: `%+`, `%-`, `%!` & `%^H` (ref. [3]).
* Missing escapes are added, such as `\x{NN..}`, `\o{NN..}` (full list in ref. [5]).

**References:**

* [1] Perl References: https://gist.github.com/afair/2402068
* [2] PerlMonks. Constant string reference: https://www.perlmonks.org/?node_id=413500
* [3] Perl Programming Documentation. perlvar: https://perldoc.perl.org/perlvar.html
* [4] PerlMonks. Perl Special Variables Quick Reference: https://www.perlmonks.org/?node_id=353259
* [5] Perl Programming Documentation. perlrebackslash: https://perldoc.perl.org/perlrebackslash.html

FIXED-IN: 5.51.0

Reviewers: cullmann, dhaumann, #framework_syntax_highlighting

Reviewed By: cullmann, #framework_syntax_highlighting

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D15397
parent b8a7413f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment