FOREACHNode( const RefDNode& refNode): BreakableNode( refNode) { ProgNodeP keep = down->GetNextSibling(); down->SetRight( down->GetNextSibling()->GetNextSibling()); keep->SetRight( NULL); FOREACH_LOOPNode* forLoop = new FOREACH_LOOPNode( right, down); forLoop->setLine( getLine()); down = keep; right = forLoop; }
FOREACH_INDEXNode( const RefDNode& refNode): BreakableNode( refNode) { // down is variable,array,variable ProgNodeP keep = down->GetNextSibling(); // the array to loop over ProgNodeP index = down->GetNextSibling()->GetNextSibling(); // the index variable down->SetRight( index); // jump over array // cut away everything after the array from keep keep->SetRight( NULL); FOREACH_INDEX_LOOPNode* forLoop = new FOREACH_INDEX_LOOPNode( right, down); forLoop->setLine( getLine()); down = keep; right = forLoop; }