<commit_before>#ifndef SRC_AST_VISITOR_HELPER_H_
#define SRC_AST_VISITOR_HELPER_H_

#include <type_traits>

#include "ast/ast_node_interface.h"
#include "ast/ast_nodes.h"

namespace clidoc {

template <typename NodeSharedPtr, typename NodeType>
struct node_is {
  static const bool value = std::is_same<
      typename NodeSharedPtr::element_type,
      NodeType>::value;
};

template <typename... Types>
struct node_is_not_;

template <typename NodeSharedPtr, typename NodeType>
struct node_is_not_<NodeSharedPtr, NodeType> {
  using type = typename std::conditional<
      node_is<NodeSharedPtr, NodeType>::value,
      std::false_type,
      std::true_type>::type;
};

template <typename NodeSharedPtr, typename NodeType, typename... RemainTypes>
struct node_is_not_<NodeSharedPtr, NodeType, RemainTypes...> {
  using type = typename std::conditional<
      node_is<NodeSharedPtr, NodeType>::value,
      std::false_type,
      typename node_is_not_<NodeSharedPtr, RemainTypes...>::type>::type;
};

template <typename NodeSharedPtr, typename... NodeTypes>
struct node_is_not {
  static const bool value = std::is_same<
      typename node_is_not_<NodeSharedPtr, NodeTypes...>::type,
      std::true_type>::value;
};

template <typename NodeSharedPtr, typename... NodeTypes>
struct node_is_one_of {
  static const bool value = !node_is_not<NodeSharedPtr, NodeTypes...>::value;
};


template <typename Callable>
struct NodeTypeModifier {
  // Could be invoked other visitors.
  template <typename TerminalTypeSharedPtr>
  static void ChangeTerminalType(TerminalTypeSharedPtr node);
  template <typename NonTerminalTypeSharedPtr>
  static void ChangeNonTerminalType(NonTerminalTypeSharedPtr node);
};

struct VisitorProcessLogic {
  NodeVisitorInterface *visitor_ptr_;
};

template <typename Callable>
class TerminalVisitor : virtual public NodeVisitorInterface {
 public:
  using NodeVisitorInterface::ProcessNode;

  explicit TerminalVisitor(Callable *callable_ptr);

  void ProcessNode(KDoubleHyphen::SharedPtr node) override;
  void ProcessNode(KOptions::SharedPtr node) override;
  void ProcessNode(PosixOption::SharedPtr node) override;
  void ProcessNode(GroupedOptions::SharedPtr node) override;
  void ProcessNode(GnuOption::SharedPtr node) override;
  void ProcessNode(Argument::SharedPtr node) override;
  void ProcessNode(Command::SharedPtr node) override;

 private:
  Callable *callable_ptr_;
};

template <typename Callable>
class NonTerminalVisitor : virtual public NodeVisitorInterface {
 public:
  using NodeVisitorInterface::ProcessNode;

  explicit NonTerminalVisitor(Callable *callable_ptr);

  void ProcessNode(LogicAnd::SharedPtr node) override;
  void ProcessNode(LogicXor::SharedPtr node) override;
  void ProcessNode(LogicOr::SharedPtr node) override;
  void ProcessNode(LogicOptional::SharedPtr node) override;
  void ProcessNode(LogicOneOrMore::SharedPtr node) override;

 private:
  Callable *callable_ptr_;<commit_msg>Removed virtual base.<commit_after>#ifndef SRC_AST_VISITOR_HELPER_H_
#define SRC_AST_VISITOR_HELPER_H_

#include <type_traits>

#include "ast/ast_node_interface.h"
#include "ast/ast_nodes.h"

namespace clidoc {

template <typename NodeSharedPtr, typename NodeType>
struct node_is {
  static const bool value = std::is_same<
      typename NodeSharedPtr::element_type,
      NodeType>::value;
};

template <typename... Types>
struct node_is_not_;

template <typename NodeSharedPtr, typename NodeType>
struct node_is_not_<NodeSharedPtr, NodeType> {
  using type = typename std::conditional<
      node_is<NodeSharedPtr, NodeType>::value,
      std::false_type,
      std::true_type>::type;
};

template <typename NodeSharedPtr, typename NodeType, typename... RemainTypes>
struct node_is_not_<NodeSharedPtr, NodeType, RemainTypes...> {
  using type = typename std::conditional<
      node_is<NodeSharedPtr, NodeType>::value,
      std::false_type,
      typename node_is_not_<NodeSharedPtr, RemainTypes...>::type>::type;
};

template <typename NodeSharedPtr, typename... NodeTypes>
struct node_is_not {
  static const bool value = std::is_same<
      typename node_is_not_<NodeSharedPtr, NodeTypes...>::type,
      std::true_type>::value;
};

template <typename NodeSharedPtr, typename... NodeTypes>
struct node_is_one_of {
  static const bool value = !node_is_not<NodeSharedPtr, NodeTypes...>::value;
};


template <typename Callable>
struct NodeTypeModifier {
  // Could be invoked other visitors.
  template <typename TerminalTypeSharedPtr>
  static void ChangeTerminalType(TerminalTypeSharedPtr node);
  template <typename NonTerminalTypeSharedPtr>
  static void ChangeNonTerminalType(NonTerminalTypeSharedPtr node);
};

struct VisitorProcessLogic {
  NodeVisitorInterface *visitor_ptr_;
};

template <typename Callable>
class TerminalVisitor : public NodeVisitorInterface {
 public:
  using NodeVisitorInterface::ProcessNode;

  explicit TerminalVisitor(Callable *callable_ptr);

  void ProcessNode(KDoubleHyphen::SharedPtr node) override;
  void ProcessNode(KOptions::SharedPtr node) override;
  void ProcessNode(PosixOption::SharedPtr node) override;
  void ProcessNode(GroupedOptions::SharedPtr node) override;
  void ProcessNode(GnuOption::SharedPtr node) override;
  void ProcessNode(Argument::SharedPtr node) override;
  void ProcessNode(Command::SharedPtr node) override;

 private:
  Callable *callable_ptr_;
};

template <typename Callable>
class NonTerminalVisitor : public NodeVisitorInterface {
 public:
  using NodeVisitorInterface::ProcessNode;

  explicit NonTerminalVisitor(Callable *callable_ptr);

  void ProcessNode(LogicAnd::SharedPtr node) override;
  void ProcessNode(LogicXor::SharedPtr node) override;
  void ProcessNode(LogicOr::SharedPtr node) override;
  void ProcessNode(LogicOptional::SharedPtr node) override;
  void ProcessNode(LogicOneOrMore::SharedPtr node) override;

 private:
  Callable *callable_ptr_;
{'fraction_non_alphanumeric': 0.09358016304347826, 'fraction_numerical': 0.0, 'mean_word_length': 6.2346437346437344, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '4865205', 'n_tokens_mistral': 1778, 'n_tokens_neox': 1729, 'n_words': 415}