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: [email protected] [mailto:antlr-interest-
> [email protected]] 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

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to