Perl: fix brackets, variables, string references and others

Authored by nibags on Sep 10 2018, 7:45 AM.

Description

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.

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]).

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]).

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.

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:

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

Details