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

A Z asicaddress at gmail.com
Wed Sep 28 12:13:56 PDT 2011


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?


More information about the antlr-interest mailing list