Bug 59921 - phpsupport doesn't handle reference operator for functions
Summary: phpsupport doesn't handle reference operator for functions
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: PHP (show other bugs)
Version: git master
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-17 02:10 UTC by Klaus Dorninger
Modified: 2013-03-31 01:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
a quick patch to make it work as expected (931 bytes, patch)
2003-06-17 02:12 UTC, Klaus Dorninger
Details
patch against cvs version 1.15 (4.75 KB, patch)
2003-08-21 17:21 UTC, Klaus Dorninger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Dorninger 2003-06-17 02:10:59 UTC
Version:           CVS (using KDE KDE 3.1.2)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 3.3 
OS:          Linux

The php parser currently only parses functions which are not returning by reference. So a function like this will not be listed in the class-view:

class foo
{
  var $data;
  function &bar()
  {
    return $data;
  }
}
Comment 1 Klaus Dorninger 2003-06-17 02:12:15 UTC
Created attachment 1829 [details]
a quick patch to make it work as expected
Comment 2 Amilcar do Carmo Lucas 2003-08-21 16:10:41 UTC
Subject: kdevelop/parts/phpsupport

CVS commit by aclu: 

Fix the php parser to parse functions which are returning by reference. (BR 59921)
i.e:
class foo 
{ 
   var $data; 
   function &bar() 
   { 
     return $data; 
   } 
} 
 
Patch by: Klaus Dorninger ( klaus in xweb.cc)
CCMAIL: 59921-done@bugs.kde.org


  M +2 -2      phpparser.cpp   1.15


--- kdevelop/parts/phpsupport/phpparser.cpp  #1.14:1.15
@@ -146,7 +146,7 @@ void PHPParser::parseFile(const QString&
 
   KRegExp classre("^[ \t]*class[ \t]+([A-Za-z_]+)[ \t]*(extends[ \t]*([A-Za-z_]+))?.*$");
-  KRegExp methodre("^[ \t]*function[ \t]*([0-9A-Za-z_]*)[ \t]*\\(([0-9A-Za-z_\\$\\, \t=&\\'\\\"]*)\\).*$");
+  KRegExp methodre("^[ \t]*function[ \t&]*([0-9A-Za-z_]*)[ \t]*\\(([0-9A-Za-z_\\$\\, \t=&\\'\\\"]*)\\).*$");
   KRegExp varre("^[ \t]*var[ \t]*([0-9A-Za-z_\\$]+)[ \t;=].*$");
-  KRegExp createMemberRe("\\$this->([0-9A-Za-z_]+)[ \t]*=[ \t]*new[ \t]+([0-9A-Za-z_]+)");
+  KRegExp createMemberRe("\\$this->([0-9A-Za-z_]+)[ \t]*=[ \t&]*new[ \t]+([0-9A-Za-z_]+)");
 
   ParsedClass *lastClass = 0;


Comment 3 Klaus Dorninger 2003-08-21 17:21:36 UTC
Created attachment 2289 [details]
patch against cvs version 1.15

the old patch was applied only to the section of the code which is commented
out, so nothing was fixed, I've created another patch against the current cvs
which doesn't only fix the regexps but also removes the unused code block (why
is it still there anyway?)
Comment 4 Klaus Dorninger 2003-08-21 17:22:16 UTC
see comment #3 
Comment 5 Amilcar do Carmo Lucas 2003-08-21 17:37:20 UTC
Subject: kdevelop/parts/phpsupport

CVS commit by aclu: 

Fix the previous patch

Patch by: Klaus Dorninger ( klaus in xweb.cc)
CCMAIL: 59921-done@bugs.kde.org


  M +2 -105    phpparser.cpp   1.16