<commit_before>// Copyright (c) 2014-2015 Dr. <NAME> and <NAME>
// Please see LICENSE for license or visit https://github.com/ColinH/PEGTL/

#ifndef PEGTL_TRACE_HH
#define PEGTL_TRACE_HH

#include <iostream>

#include "parse.hh"
#include "normal.hh"
#include "nothing.hh"
#include "position_info.hh"

#include "internal/demangle.hh"

namespace pegtl
{
   template< typename Rule >
   struct tracer
         : normal< Rule >
   {
      template< typename Input, typename ... States >
      static void start( const Input & in, States && ... )
      {
         std::cerr << position_info( in ) << "  start  " << internal::demangle< Rule >() << std::endl;
      }

      template< typename Input, typename ... States >
      static void success( const Input & in, States && ... )
      {
         std::cerr << position_info( in ) << " success " << internal::demangle< Rule >() << std::endl;
      }

      template< typename Input, typename ... States >
      static void failure( const Input & in, States && ... )
      {
         std::cerr << position_info( in ) << " failure " << internal::demangle< Rule >() << std::endl;
      }
   };

   template< typename Rule, template< typename ... > class Action = nothing, typename ... Args >
   bool trace( Args && ... args )
   {
      return parse< Rule, Action, tracer >( std::forward< Args >( args ) ... );
   }

} // pegtl

#endif<commit_msg>Added trace_input<commit_after>// Copyright (c) 2014-2015 Dr. <NAME> and <NAME>
// Please see LICENSE for license or visit https://github.com/ColinH/PEGTL/

#ifndef PEGTL_TRACE_HH
#define PEGTL_TRACE_HH

#include <iostream>

#include "parse.hh"
#include "normal.hh"
#include "nothing.hh"
#include "position_info.hh"

#include "internal/demangle.hh"

namespace pegtl
{
   template< typename Rule >
   struct tracer
         : normal< Rule >
   {
      template< typename Input, typename ... States >
      static void start( const Input & in, States && ... )
      {
         std::cerr << position_info( in ) << "  start  " << internal::demangle< Rule >() << std::endl;
      }

      template< typename Input, typename ... States >
      static void success( const Input & in, States && ... )
      {
         std::cerr << position_info( in ) << " success " << internal::demangle< Rule >() << std::endl;
      }

      template< typename Input, typename ... States >
      static void failure( const Input & in, States && ... )
      {
         std::cerr << position_info( in ) << " failure " << internal::demangle< Rule >() << std::endl;
      }
   };

   template< typename Rule, template< typename ... > class Action = nothing, typename Input, typename ... States >
   bool trace_input( Input & in, States && ... st )
   {
      return parse_input< Rule, Action, tracer >( in, st ... );
   }

   template< typename Rule, template< typename ... > class Action = nothing, typename ... Args >
   bool trace( Args && ... args )
   {
      return parse< Rule, Action, tracer >( args ... );
   }

} // pegtl

#endif
{'fraction_non_alphanumeric': 0.1558960692871419, 'fraction_numerical': 0.005329780146568954, 'mean_word_length': 2.5163934426229506, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 0, '>': 35, 'https://': 2, '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': '1623832', 'n_tokens_mistral': 943, 'n_tokens_neox': 901, 'n_words': 267}