Php::DeclarationBuilder:different IdentifierAsts

Hamish Rodda rodda at kde.org
Mon Jun 23 00:26:42 UTC 2008


Hi,

On Sun, 22 Jun 2008 11:15:02 pm Niko Sams wrote:
> Hi,
>
> Using the abstractbuilder-classes works great so far, I just commited
> a first duchain-builder
> for php - please review it. I tried to stay as close as possible to
> the java builders.

Great.  Looking good.

> I have a problem now with identifiers in this example code:
> class A {}
> function foo($b) {}
>
> I allready changed the grammar to include an identifer-rule (that
> currently is only a STRING)
> to class A works.
> However $b is not an identifier, as it is a VARIABLE-token instead of
> a STRING-token.
> So I can't call openDefinition(node->variableName) in the
> DeclarationBuilder.
>
> Any ideas how this could be solved?
> Should I modify the grammar to have STRING or VARIABLE in the identifier
> rule? Or could the abstractbuilder be extended to support different
> identifierAsts?

I have added an openDeclaration function which takes a qualified identifier 
and a SimpleRange instead of nodes, try them.

BTW, if you have multiple identifier ast node types, you can pass the base ast 
node class to the template as the NameT type, then you can support them 
inside your context builder.  This does lose some type safety, but you can't 
help that if you have more than one type of identifier node in your ast.

Cheers,
Hamish.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20080623/c07492d8/attachment.sig>


More information about the KDevelop-devel mailing list