void interpreter::interpret (const parameters& params) { DEBUGF ('i', params); param begin = params.cbegin(); // First word contains command name // Either define, draw, border, or moveby string command = *begin; DEBUGF('i', command); auto itor = interp_map.find (command); if (itor == interp_map.end()) throw runtime_error ("syntax error"); interpreterfn func = itor->second; for (auto i = begin; i != params.cend(); ++i) { cout << *i << " "; } cout << endl; func (++begin, params.cend()); }
void interpreter::interpret (const parameters& params) { DEBUGF ('i', params); param begin = params.cbegin(); string command = *begin; auto itor = interp_map.find (command); if (itor == interp_map.end()) throw runtime_error ("syntax error"); interpreterfn func = itor->second; func (++begin, params.cend()); }