[Geany-devel] [Patch] - Improve PHP parser (call tips)

Enrico Tröger enrico.troeger at xxxxx
Sun Apr 18 08:20:05 UTC 2010


On Sun, 18 Apr 2010 03:05:53 +0200, Dominic wrote:

>Am Samstag, den 17.04.2010, 18:14 +0200 schrieb Enrico Tröger:
>> I spent a little more time on this again hoping to get it fixed.
>> In SVN r4828, I adjusted the regular expression for parsing PHP
>> functions a bit and I think it works now as expected or at least
>> better than before. All function definitions I tried (with static,
>> public, ... modifiers and some without and so on) worked and I got
>> the expected argument list as calltip.
>> 
>> Though, as muliple times mentioned before, I'm not a PHP guy.
>> Feedback is welcome.
>
>Your pattern seems to work fine now. I've successfully tested different
>cases as attached and any combination of testcase 1-3 with testcase 4.

Thanks for testing.


>Since we're obviously writing object-oriented PHP here (because we're
>using public static anything and so on), it would be nice, if Geany
>also would parse the so called magic methods [1]. You may noted the
>__construct method in the attached files. This method is called when a

The __construct methods are already parsed and listed in the Symbol
list.


>new instance is created as you see in line 24. For completeness Geany
>should also show calltips in that line when creating the new instance.

This is not possible with the current implementation of the parser.
Since it is based on regular expressions which only work line-based,
there is no information about a possibly following __construct() method
when it is parsing a class definition.
This is also the reason why the parser often fails at ignoring
statements inside multi-line comments.

As I said a couple of times in the past, the best solution would be to
rewrite the parser to parse the whole source file at once as most other
parsers do instead of simple regexps for each line. PHP is simply to
complex for such a simple approach.
As usual, it needs someone to do it.


Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100418/dc2ddf22/attachment.pgp>


More information about the Devel mailing list