[antlr-interest] C-target 3.2 : getParent returns invalid pointer

Jim Idle jimi at temporal-wave.com
Wed Sep 28 12:27:34 PDT 2011


Can't tell without seeing your code I am afraid, have you traced the
pointers in the debugger? Checked that your i is correct? What does
runPackageTree do? What does thisIndex look like? etc


Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of A Z
> Sent: Wednesday, September 28, 2011 12:14 PM
> To: antlr-interest Interest
> Subject: [antlr-interest] C-target 3.2 : getParent returns invalid
> pointer
>
> Hello All,
>
> I'm trying to run a tree parser on part of a tree and then delete that
> sub-tree but I can't get the parent of the node that needs to be
> deleted.
>
> //For each i in pPackageList
>     pANTLR3_BASE_TREE thisNode = pPackageList->at(i);
>
>     pANTLR3_BASE_TREE parentNode = thisNode->getParent(thisNode);
>
>     unsigned int thisIndex = thisNode->getChildIndex(thisNode);
>
>     runPackageTree(thisNode);
>
>     parentNode->deleteChild(parentNode,thisIndex);
>
> After calling getParent, parentNode is 0x38 which isn't a valid
> pointer. The parent for thisNode should be a NilNode so I'm wondering
> if that is causing a problem. I tried using deleteChild() on the node
> returned from the parser rule but it still segfaults. Is there
> something special needed to remove a child from the root node?
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list