3 #include "list_iterator.h"
9 ListIterator::ListIterator(const lisp::Lisp* newlisp)
10 : current_lisp(0), cur(newlisp)
20 const lisp::Lisp* child = cur->get_car();
22 throw new std::runtime_error("child is 0 in list entry");
23 if(child->get_type() != lisp::Lisp::TYPE_CONS)
24 throw new std::runtime_error("Expected CONS");
25 const lisp::Lisp* name = child->get_car();
26 if(!name || name->get_type() != lisp::Lisp::TYPE_SYMBOL)
27 throw new std::runtime_error("Expected symbol");
28 name->get(current_item);
29 current_lisp = child->get_cdr();