The current implementation of symbol viewer's perl parser can incorrectly identify lines lines that match '^\s=' as the beginning of a comment. Reproducible: Always Steps to Reproduce: 1. Open create a perl file that has code like: my $foo = 'bar'; 2. Observe that symbol viewer's perl parser interprets the line "= 'bar';" as the start of a comment. Actual Results: This should not be interpreted as a comment. It is a multi-line statement with an assignment operator beginning the second line. Perl's documentation at: http://perldoc.perl.org/perlpodspec.html Specifies that a comment begins with a line that "matches <m/\A=[a-zA-Z]/>". In other words, the line must begin with a '=' character followed immediately by an alpha character. Expected Results: Symbol viewer's perl parser should only identify lines as the beginning of a comment if they match perl's documented pattern that identifies the start of a comment.
Created attachment 81714 [details] Sample test case
I have attached a sample test case that highlights the pitfalls of the current implementation.
Created attachment 81715 [details] Proposed patch
And finally, I've attached a patch that addresses these shortcomings by not trimming the line being analyzed until after comment detection has been attempted and by modifying the regular expression used to identify the beginning of a comment.
Git commit 94719b9790671b27a80698ee55439f9a59db4b38 by Dominik Haumann. Committed on 15/08/2013 at 07:20. Pushed by dhaumann into branch 'master'. symbol viewer: fix perl parsing comments problem was: my $foo = 'bar'; Thanks to John Schroeder for the patch! FIXED-IN: 4.11.1 M +4 -3 addons/kate/symbolviewer/perl_parser.cpp http://commits.kde.org/kate/94719b9790671b27a80698ee55439f9a59db4b38
Git commit dc74d823340c75a4d06b9b3da2c40dff04852af9 by Dominik Haumann. Committed on 15/08/2013 at 07:20. Pushed by dhaumann into branch 'KDE/4.11'. symbol viewer: fix perl parsing comments problem was: my $foo = 'bar'; Thanks to John Schroeder for the patch! FIXED-IN: 4.11.1 M +4 -3 addons/kate/symbolviewer/perl_parser.cpp http://commits.kde.org/kate/dc74d823340c75a4d06b9b3da2c40dff04852af9
John, if you want, you can also ask for commit access http://sysadmin.kde.org/tickets/ so that you can commit yourself :-)