<commit_before>#include <ostream>

#include "pn/tina.hh"

namespace pnmc { namespace pn {

/*------------------------------------------------------------------------------------------------*/

void
tina(std::ostream& out, const net& net)
{
  for (const auto& transition : net.transitions())
  {
    out << "tr t" << transition.id;
    for (const auto& arc : transition.pre)
    {
      out << " p" << arc.first;
    }
    out << " ->";
    for (const auto& arc : transition.post)
    {
      out << " p" << arc.first;
    }
    out << "\n";
  }

  for (const auto& place : net.places())
  {
    out << "pl p" << place.id << " (" << place.marking << ")\n";
  }

  out << "net generated_net\n";
}

/*------------------------------------------------------------------------------------------------*/

}} // pnmc::pn<commit_msg>TINA doesn't like dots in identifiers.<commit_after>#include <algorithm>
#include <ostream>

#include "pn/tina.hh"

namespace pnmc { namespace pn {

/*------------------------------------------------------------------------------------------------*/

namespace /* anonymous */ {

std::string
format(const std::string& str)
{
  std::string res;
  res.reserve(str.size());
  std::transform( str.cbegin(), str.cend(), std::back_inserter(res)
                , [](char c){if (c == '.') return '_'; else return c;});
  return res;
}

}

/*------------------------------------------------------------------------------------------------*/

void
tina(std::ostream& out, const net& net)
{
  for (const auto& transition : net.transitions())
  {
    out << "tr t" << format(transition.id);
    for (const auto& arc : transition.pre)
    {
      out << " p" << format(arc.first);
    }
    out << " ->";
    for (const auto& arc : transition.post)
    {
      out << " p" << format(arc.first);
    }
    out << "\n";
  }

  for (const auto& place : net.places())
  {
    out << "pl p" << format(place.id) << " (" << place.marking << ")\n";
  }

  out << "net generated_net\n";
}

/*------------------------------------------------------------------------------------------------*/

}} // pnmc::pn
{'fraction_non_alphanumeric': 0.39070649596965384, 'fraction_numerical': 0.0, 'mean_word_length': 1.2422954303931988, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4389867', 'n_tokens_mistral': 623, 'n_tokens_neox': 612, 'n_words': 142}