示例#1
0
文件: interp.cpp 项目: dkma1026/cmps
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());
}
示例#2
0
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());
}