<commit_before>// Copyright (c) 2015 <NAME>
// All rights reserved

#ifndef LINGI_UTIL_DEBUG_HPP
#define LINGI_UTIL_DEBUG_HPP

#include "lingo/print.hpp"

#include <iosfwd>
#include <sstream>
#include <iterator>
#include <stdexcept>

namespace lingo
{

// A helper facility for printing the header and trailer
// of a node.
template<typename T>
struct sexpr
{
  sexpr(Printer& p, T const* n, bool space = true)
    : p(p)
  {
    print_chars(p, '(');
    print_chars(p, n->node_name());
    if (space)
      print_space(p);
  }
  ~sexpr()
  {
    print_chars(p, ')');
  }
  Printer& p;
};


std::ostream& default_debug_stream();


// A dummy function that provides a name for an
// overload set.
void debug(Printer& p, void*) = delete;


// Debug print the integral value n.
inline void 
debug(Printer& p, std::intmax_t n)
{
  print_value(p, n);
}


// Debug print a string.
inline void
debug(Printer& p, char const* s)
{
  print_chars(p, s);
}<commit_msg>Update overload list for debug printing.<commit_after>// Copyright (c) 2015 <NAME>
// All rights reserved

#ifndef LINGI_UTIL_DEBUG_HPP
#define LINGI_UTIL_DEBUG_HPP

#include "lingo/print.hpp"

#include <iosfwd>
#include <sstream>
#include <iterator>
#include <stdexcept>

namespace lingo
{

// A helper facility for printing the header and trailer
// of a node.
template<typename T>
struct sexpr
{
  sexpr(Printer& p, T const* n, bool space = true)
    : p(p)
  {
    print_chars(p, '(');
    print_chars(p, n->node_name());
    if (space)
      print_space(p);
  }
  ~sexpr()
  {
    print_chars(p, ')');
  }
  Printer& p;
};


std::ostream& default_debug_stream();


// Debug print the integral value `n`.
template<typename T>
inline typename std::enable_if<std::is_integral<T>::value, void>::type
debug(Printer& p, T n)
{
  print_value(p, (intmax_t)n);
}


// Debug print the integer representation of the enumerated
// value `n`.
template<typename T>
inline typename std::enable_if<std::is_enum<T>::value, void>::type
debug(Printer& p, T n)
{
  print_value(p, (intmax_t)n);
}


// Debug print a string.
inline void
debug(Printer& p, char const* s)
{
  print_chars(p, s);
}
{'fraction_non_alphanumeric': 0.1443975621190811, 'fraction_numerical': 0.003750586029067042, 'mean_word_length': 3.928406466512702, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, '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': '4462849', 'n_tokens_mistral': 815, 'n_tokens_neox': 787, 'n_words': 223}