void DSubUD::ResolveLabel( ProgNodeP p) { if( p == NULL) return; // if( p->getNextSibling() != NULL) // std::cout << "Resolve("<< p->getLine()<<"): " << p << " keepRight: " << p->KeepRight()<< ": "<< p->getText() <<" r: "<< p->GetNextSibling()->getText() << std::endl; // else // std::cout << "Resolve("<< p->getLine()<<"): " << p << " keepRight: " << p->KeepRight()<< ": "<< p->getText() <<" r: NULL"<< std::endl; if( p->getType() == GDLTreeParser::ON_IOERROR || p->getType() == GDLTreeParser::GOTO) { int ix = labelList.Find( p->getText()); if( ix == -1) throw GDLException( p, ObjectName()+": Undefined label "+p->getText()+ " referenced in GOTO statement.",false,false); p->SetGotoIx( ix); } else if( p->getType() == GDLTreeParser::LABEL) { labelList.SetLabelNode( p); } if( !p->KeepDown()) ResolveLabel( p->getFirstChild()); if( !p->KeepRight()) ResolveLabel( p->getNextSibling()); // else // ResolveLabel( p->getNextSibling()); }
ProgNodeP GetLastSibling() const { ProgNodeP act = const_cast<ProgNodeP>(this); while(!act->KeepRight() && act->GetNextSibling() != NULL) act = act->GetNextSibling(); return act; }