/*************************************************************************** subscription.cpp - description ------------------- begin : Thu Mar 20 20:36:22 2003 copyright : (C) 2002 by Cavalli Andrea email : cavalli@bioc.unizh.ch **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include ZObj * Subscription::eval(){ //exec_line done exec_line = line; ZObj * i = expr->eval(); ZObj * p = primary->eval(); // cout<<"DEBUG "<type()<(p); if(list){ //cout<<"DEBUG list"< * el = dynamic_cast *>(i); if(el) return list->element(el->data); } { ZType * el = dynamic_cast *>(i); if(el) return list->element(el->data); } throw ZError(line,"invalid subscription"); // return list->element(el->data); } ZObj * res = ZObj::BinaryOperator::apply(p,i); ZObj::remove(p); ZObj::remove(i); if(res!=NULL) return res; // else throw ZError(line,"invalid subscription: "+p->class_name()+" "+ // i->class_name()); else throw ZError(line,"invalid subscription"); } void Subscription::check(){ expr->check(); primary->check(); Almost::aout<<"INDEX\n"<