SUMMARY With some files, the perl syntax highlighting gets confused. STEPS TO REPRODUCE 1. Create a new file 2. Paste in the two lines: $x = ns // ""; print $x; 3. Save the file as foo.pl OBSERVED RESULT The syntax highlight goes wrong at the second slash. Everything after that is mostly green EXPECTED RESULT The highlighting should be right. "print" should be black. SOFTWARE/OS VERSIONS Debian/Buster KDE Plasma Version: 4:5.14.5.1-1 (debian plasma-workspace) KDE Frameworks Version: KDE Frameworks 5.54.0 Qt Version: Qt 5.11.3 (built against 5.11.3) The xcb windowing system Kate Part Version 5.54.0 ADDITIONAL INFORMATION It looks like the problem has something to do with the "//" operator. In some contexts that works all right, like if I use $ns instead of ns. The original code example is from Catmandu::Exporter::RDF, from libcatmandu-rdf-perl 0.32-2, where the line looks like this: RDF::aREF::Decoder->new( ns => $_[0]->ns // ($_[0]->ns eq 0 ? { } : RDF::NS->new), callback => $_[0]->model );
Git commit 4cf3a7e9825da99914e3641fb484270813943d08 by Nibaldo González. Committed on 19/05/2019 at 11:41. Pushed by ngonzalez into branch 'master'. Perl: fix the // operator Summary: The "/" character is used for patterns and this causes the "//" operator not to be highlighted correctly in some situations, such as after identifiers. Reviewers: #framework_syntax_highlighting, dhaumann, cullmann Reviewed By: #framework_syntax_highlighting, dhaumann, cullmann Subscribers: kwrite-devel, kde-frameworks-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D21286 M +4 -0 autotests/folding/highlight.pl.fold M +4 -0 autotests/html/highlight.pl.html M +4 -0 autotests/input/highlight.pl M +4 -0 autotests/reference/highlight.pl.ref M +6 -3 data/syntax/perl.xml https://commits.kde.org/syntax-highlighting/4cf3a7e9825da99914e3641fb484270813943d08