<commit_before>#ifndef NODE_H_WML097FE
#define NODE_H_WML097FE

#include "Basic.h"
#include "Codegen.h"
#include <string>
#include <list>

namespace snot {
namespace ast {
	class Node {
	public:
		virtual ~Node() {}
		
		virtual void realize(Codegen&) {};
		
		template <class T>
		bool is_a() const { return dynamic_cast<T*>(this) != NULL; }
	};
	
	class Literal : public Node {
	public:
		enum Type {
			STRING_TYPE,
			INTEGER_TYPE,
			INTEGER_DEC_TYPE = INTEGER_TYPE,
			INTEGER_HEX_TYPE,
			INTEGER_BIN_TYPE,
			FLOAT_TYPE,
		};
	protected:
		std::string m_String;
		Type m_Type;
	public:
		Literal(const std::string& str, Type type) : m_String(str), m_Type(type) {}
	};
	
	class Identifier : public Node {
	protected:
		std::string m_Name;
	public:
		Identifier(const std::string& name) : m_Name(name) {}
	};
	
	class Sequence : public Node {
	protected:
		std::list<RefPtr<Node>> m_Nodes;
	public:
		void add(RefPtr<Node> node) { m_Nodes.push_back(node); }
		std::list<RefPtr<Node>>& nodes() { return m_Nodes; }
		const std::list<RefPtr<Node>>& nodes() const { return m_Nodes; }
		virtual void realize(Codegen&);
	};
	
	class Condition : public Node {
	protected:
		RefPtr<Node> m_Expression;
	public:
		Condition(RefPtr<Node> expr) : m_Expression(expr) {}
		virtual void realize(Codegen&);
	};
	
	class IfCondition : public Condition {
	protected:
		RefPtr<Node> m_IfTrue;
	public:
		IfCondition(RefPtr<Node> expr, RefPtr<Node> if_true) : Condition(expr), m_IfTrue(if_true) {}
		virtual void realize(Codegen&);
	};<commit_msg>ast: added Scope, Assignment<commit_after>#ifndef NODE_H_WML097FE
#define NODE_H_WML097FE

#include "Basic.h"
#include "Codegen.h"
#include <string>
#include <list>

namespace snot {
namespace ast {
	class Node {
	public:
		virtual ~Node() {}
		
		virtual void realize(Codegen&) {};
		
		template <class T>
		bool is_a() const { return dynamic_cast<T*>(this) != NULL; }
	};
	
	class Literal : public Node {
	public:
		enum Type {
			STRING_TYPE,
			INTEGER_TYPE,
			INTEGER_DEC_TYPE = INTEGER_TYPE,
			INTEGER_HEX_TYPE,
			INTEGER_BIN_TYPE,
			FLOAT_TYPE,
		};
	protected:
		std::string m_String;
		Type m_Type;
	public:
		Literal(const std::string& str, Type type) : m_String(str), m_Type(type) {}
	};
	
	class Identifier : public Node {
	protected:
		std::string m_Name;
	public:
		Identifier(const std::string& name) : m_Name(name) {}
	};
	
	class Sequence : public Node {
	protected:
		std::list<RefPtr<Node>> m_Nodes;
	public:
		void add(RefPtr<Node> node) { m_Nodes.push_back(node); }
		std::list<RefPtr<Node>>& nodes() { return m_Nodes; }
		const std::list<RefPtr<Node>>& nodes() const { return m_Nodes; }
		virtual void realize(Codegen&);
	};
	
	class Scope : public Node {
	protected:
		std::list<RefPtr<Identifier>> m_Arguments;
		RefPtr<Sequence> m_Sequence;
	public:
		void add(RefPtr<Node> node) { m_Sequence->add(node); }
	};
	
	class Assignment : public Node {
	protected:
		RefPtr<Identifier> m_Identifier;
		RefPtr<Node> m_Expression;
	public:
		Assignment(RefPtr<Identifier> ident, RefPtr<Node> expr) : m_Identifier(ident), m_Expression(expr) {}
	};
	
	class Condition : public Node {
	protected:
		RefPtr<Node> m_Expression;
	public:
		Condition(RefPtr<Node> expr) : m_Expression(expr) {}
		virtual void realize(Codegen&);
	};
	
	class IfCondition : public Condition {
	protected:
		RefPtr<Node> m_IfTrue;
	public:
		IfCondition(RefPtr<Node> expr, RefPtr<Node> if_true) : Condition(expr), m_IfTrue(if_true) {}
		virtual void realize(Codegen&);
	};
{'fraction_non_alphanumeric': 0.13314285714285715, 'fraction_numerical': 0.0034285714285714284, 'mean_word_length': 4.655896607431341, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 44, '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': '4767390', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1258, 'n_words': 289}