Bug 78328 - Perl function name parser bug
Summary: Perl function name parser bug
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: 3.0.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-23 21:46 UTC by mrsmellysock
Modified: 2004-10-30 20:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mrsmellysock 2004-03-23 21:46:57 UTC
Version:           3.0.2 (using KDE 3.2.1, SuSE)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:          Linux (i686) release 2.4.21-144-default

In a perl file, the parser chokes on this function definition:

sub foo{
  blah blah;
}

If a space or parens are added between foo and the opening bracket, like so:

sub foo {
 blah blah;
}

the parser suddenly knows the subroutine is there. This breaks both the class broswser (the function never shows up) and the editors folding (it doesn't know the function is there, therefore no folding FOR ME).
Comment 1 Richard Lärkäng 2004-10-30 15:53:58 UTC
CVS commit by larkang: 

Don't require a whitespace between function name and the opening bracket

CCBUG: 78328


  M +1 -1      perlparser.cpp   1.5


--- kdevelop/languages/perl/perlparser.cpp  #1.4:1.5
@@ -73,5 +73,5 @@ void perlparser::parseLines(QStringList*
   QRegExp   globalre("^[ \t]*our[ \t]+\\(*([ \t,$%@*+A-Za-z0-9_]*)\\)*.*");
   QRegExp   myre("^[ \t]*my[ \t]+\\(*([ \t,$%@*+A-Za-z0-9_]*)\\)*.*");
-  QRegExp      subre("^[ \t]*sub[ \t]+([A-Za-z0-9_]+)([A-Za-z0-9_]|([ \t]+[{])?)$");
+  QRegExp      subre("^[ \t]*sub[ \t]+([A-Za-z0-9_]+)([A-Za-z0-9_]|([ \t]*[{])?)$");
   QRegExp    blessre("bless[ \t]*[\\( ]*([,$%@*+A-Za-z0-9_]*).*;");
   QRegExp     namere("^[ \t]*([$%@*])([A-Za-z0-9_]*).*$");


Comment 2 Richard Lärkäng 2004-10-30 15:56:25 UTC
Reassigning to kate, since part about folding is a bug in the kate part.
Comment 3 Anders Lund 2004-10-30 17:37:36 UTC
CVS commit by alund: 

CCBUG: 78328


  M +1 -3      perl.xml   1.37.2.1


--- kdelibs/kate/data/perl.xml  #1.37:1.37.2.1
@@ -33,5 +33,5 @@
    HERE document delimiters - requires support for saving data in contexts.
 -->
-<language name="Perl" version="1.12" kateversion="2.3" section="Scripts" extensions="*.pl;*.pm" mimetype="application/x-perl;text/x-perl" author="Anders Lund (anders@alweb.dk)" license="LGPL">
+<language name="Perl" version="1.13" kateversion="2.3" section="Scripts" extensions="*.pl;*.pm" mimetype="application/x-perl;text/x-perl" author="Anders Lund (anders@alweb.dk)" license="LGPL">
   <highlighting>
     <list name="keywords">
@@ -60,5 +60,4 @@
       <item>require</item>
       <item> package </item>
-      <item> sub </item>
       <item> do </item>
       <item> __END__ </item>
@@ -272,5 +271,4 @@
       <item>stat</item>
       <item>study</item>
-      <item>sub</item>
       <item>substr</item>
       <item>symlink</item>


Comment 4 Anders Lund 2004-10-30 20:19:18 UTC
CVS commit by alund: 

better fix.
HEAD will follow during sunday (i have other changes).
BUG: 78328


  M +3 -1      perl.xml   1.37.2.2


--- kdelibs/kate/data/perl.xml  #1.37.2.1:1.37.2.2
@@ -60,4 +60,5 @@
       <item>require</item>
       <item> package </item>
+      <item> sub </item>
       <item> do </item>
       <item> __END__ </item>
@@ -271,4 +272,5 @@
       <item>stat</item>
       <item>study</item>
+      <item>sub</item>
       <item>substr</item>
       <item>symlink</item>
@@ -323,4 +325,5 @@
         <RegExpr attribute="Keyword" context="data_handle" String="^__DATA__" />
         <RegExpr attribute="Keyword" context="#stay" String="^__END__" />
+        <RegExpr attribute="Keyword" context="sub_name_def" String="\s*sub\s+" />
         <keyword attribute="Keyword" context="#stay" String="keywords" />
         <keyword attribute="Operator" context="#stay" String="operators" />
@@ -329,5 +332,4 @@
         <RegExpr attribute="Comment" context="comment" String="#" />
         <RegExpr attribute="Pod" context="pod" String="^\=(?:head[1-6]|over|back|item|for|begin|end|pod)\s*.*" beginRegion="POD"/>
-        <RegExpr attribute="Keyword" context="sub_name_def" String="\s*sub\s+" />
 
         <HlCOct attribute="Octal" context="slash_safe_escape" />