void parse(const std::string &filename) {
   try {
     parse_impl(filename);
   }
   catch (...) {
     thread_exception_ = std::current_exception();
   }
 }
Esempio n. 2
0
 boost::tribool parse( InputIterator & iter, InputIterator end, basic_message<Tag> & message )
 {
     boost::tribool result = parse_impl( iter, end, message );
     if ( result == true )
     {
         typedef typename chunk_cache_type::value_type cache_type;
         BOOST_FOREACH(cache_type const & c, chunk_cache_)
         {
             message.body().insert(message.body().end(), c.begin(), c.end());
         }
     }
Esempio n. 3
0
int main(int argc, char *argv[])
{
  bool success = true;

  if (argc < 3) {
    std::cerr << "Syntax error: use" << std::endl;
    std::cerr << argv[0] << " classname inputpath" << std::endl;
    return 1;
  }

  std::string modname(argv[1]);
  std::string inputpath(argv[2]);
  std::string ifname = inputpath + std::string("/") + modname + std::string("_tests.un");
  std::string impl_fname = modname + std::string("_test_impls-tmp.F90");
  std::string calls_fname = modname + std::string("_test_calls.F90");
  std::string list_fname = modname + std::string("_tests.tests");
  std::string mpilist_fname = modname + std::string("_tests.mpitests");

  std::vector<std::string> input, output;

  try {
    success = success && read_template(ifname, input);
    success = success && replace_modname(modname, input);

    success = success && parse_impl(ifname, input, output);
    success = success && write_output(impl_fname, output);
    output.clear();

    success = success && parse_calls(ifname, input, output);
    success = success && write_output(calls_fname, output);
    output.clear();

    success = success && parse_list(ifname, input, output);
    success = success && write_output(list_fname, output);
    output.clear();

    success = success && parse_mpilist(ifname, input, output);
    success = success && write_output(mpilist_fname, output);
    output.clear();
  } catch (ParserException &ex) {
    std::cerr << "Caught exception: " << ex.getMsg() << std::endl;
    success = false;
  } catch (std::string &ex) {
    std::cerr << "Caught exception: " << ex << std::endl;
    success = false;
  } catch (...) {
    std::cerr << "Caught unknown exception." << std::endl;
    success = false;
  }

  return (success ? 0 : 1);
}