<commit_before>#ifndef NODES_H_
#define NODES_H_

#include <vector>
#include <string>
#include <memory>

#include "global.h"
#include "std_is_missing_stuff.h"
#include "operators.h"
#include "tokens.h"

namespace nodes {

class ASTNode {
protected:
  ASTNode* parent = nullptr;
  std::vector<ASTNode*> children {};
public:
  ASTNode();
  virtual ~ASTNode();
  
  void addChild(ASTNode* child);
  std::vector<ASTNode*> getChildren();
  void setParent(ASTNode* parent);
  ASTNode* getParent();
  
  virtual void printTree(int level);
};

typedef std::vector<ASTNode*> ChildrenNodes;

class DeclarationNode: public ASTNode {
public:
  std::string typeName;
  std::string identifier;

  DeclarationNode(std::string typeName, std::string identifier);
};

// TODO: restrict to one child only
class ExpressionNode: public ASTNode {
private:
  static std::vector<TokenType> validOperandTypes;
  std::vector<Token> opStack {};
  std::vector<Token> outStack {};
  
  // Moves the top of the opStack to the top of the outStack
  inline void popToOut() {
    outStack.push_back(opStack.back());
    opStack.pop_back();
  }
public:
  ExpressionNode(std::vector<Token>& tokens);
  
  std::vector<Token> getRPNOutput();
  void buildSubtree();
  void printTree(int level);
};

class ExpressionChildNode: public ASTNode {
public:
  Token t;
  ExpressionChildNode(Token operand);
  ExpressionChildNode(Token op, std::vector<Token>& operands);
  
  void printTree(int level);
};


class AbstractSyntaxTree {
private:
  ASTNode root = ASTNode();
public:
  AbstractSyntaxTree();
  
  void addRootChild(ASTNode* node);
  ChildrenNodes getRootChildren();
};

typedef nodes::AbstractSyntaxTree AST;

} /* namespace nodes */

#endif /* NODES_H_ */
<commit_msg>Made some member initialization explicit<commit_after>#ifndef NODES_H_
#define NODES_H_

#include <vector>
#include <string>
#include <memory>

#include "global.h"
#include "std_is_missing_stuff.h"
#include "operators.h"
#include "tokens.h"

namespace nodes {

class ASTNode {
protected:
  ASTNode* parent = nullptr;
  std::vector<ASTNode*> children {};
public:
  ASTNode();
  virtual ~ASTNode();
  
  void addChild(ASTNode* child);
  std::vector<ASTNode*> getChildren();
  void setParent(ASTNode* parent);
  ASTNode* getParent();
  
  virtual void printTree(int level);
};

typedef std::vector<ASTNode*> ChildrenNodes;

class DeclarationNode: public ASTNode {
public:
  std::string typeName;
  std::string identifier;

  DeclarationNode(std::string typeName, std::string identifier);
};

// TODO: restrict to one child only
class ExpressionNode: public ASTNode {
private:
  static std::vector<TokenType> validOperandTypes;
  std::vector<Token> opStack = std::vector<Token>();
  std::vector<Token> outStack = std::vector<Token>();
  
  // Moves the top of the opStack to the top of the outStack
  inline void popToOut() {
    outStack.push_back(opStack.back());
    opStack.pop_back();
  }
public:
  ExpressionNode(std::vector<Token>& tokens);
  
  std::vector<Token> getRPNOutput();
  void buildSubtree();
  void printTree(int level);
};

class ExpressionChildNode: public ASTNode {
public:
  Token t;
  ExpressionChildNode(Token operand);
  ExpressionChildNode(Token op, std::vector<Token>& operands);
  
  void printTree(int level);
};


class AbstractSyntaxTree {
private:
  ASTNode root = ASTNode();
public:
  AbstractSyntaxTree();
  
  void addRootChild(ASTNode* node);
  ChildrenNodes getRootChildren();
};

typedef nodes::AbstractSyntaxTree AST;

} /* namespace nodes */

#endif /* NODES_H_ */

{'fraction_non_alphanumeric': 0.12193148098192609, 'fraction_numerical': 0.0, 'mean_word_length': 3.990578734858681, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '3640986', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1161, 'n_words': 292}