Skip to content
Snippets Groups Projects
Transition.cpp 522 B
Newer Older
#include "Transition.hpp"
#include <regex>
Transition::Transition(const std::string & name)
{
  this->name = name;

  std::regex writeRegex("WRITE ([bs])\\.(.+) (.+) (.+)");

  std::smatch sm;

  try
  {

  std::regex_match(name, sm, writeRegex);
  if (!sm.empty())
  {
    sequence.emplace_back(Action::addHypothesisRelative(sm[3], Action::str2object(sm[1]), std::stoi(sm[2]), sm[4]));
    return;
  }

  throw std::exception();

  } catch (std::exception &) {util::myThrow(fmt::format("Invalid name '{}'", name));}

}