<commit_before>#ifndef SETI_ABSTRACT_OBJ_H
#define SETI_ABSTRACT_OBJ_H

#include <string>
#include <memory>
#include <unordered_map>
#include <tuple>
#include <list>

#include "run_time_error.h"
#include "symbol_table.h"

namespace setti {
namespace internal {

class Executor;

class Object {
 public:
  enum class ObjectType: uint8_t {
    NIL,
    INT,
    BOOL,
    REAL,
    STRING,
    SLICE,
    ARRAY,
    MAP,
    TUPLE,
    FUNC,
    TYPE,
    CUSTON
  };

  virtual ~Object() {}

  inline ObjectType type() const {
    return type_;
  }

  virtual void Print() = 0;

  virtual std::size_t Hash() const = 0;

  virtual bool operator==(const Object& obj) const = 0;

  virtual bool ObjBool() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no bool interface"));
  }

  virtual bool ObjString() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no string interface"));
  }

  virtual bool ObjInt() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no int interface"));
  }

  virtual bool ObjCmd() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no cmd interface"));
  }

  virtual std::shared_ptr<Object> Copy() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no copy method"));
  }

  std::shared_ptr<Object> ObjType() const noexcept {
    return obj_type_;
  }

 private:
  // enum type
  ObjectType type_;

  // type of object, it is other object
  std::shared_ptr<Object> obj_type_;

  SymbolTableStack sym_table_;

 protected:
  Object(ObjectType type, std::shared_ptr<Object> obj_type,
         SymbolTableStack&& sym_table)
      : type_(type)
      , obj_type_(obj_type)
      , sym_table_(std::move(sym_table)){}<commit_msg>Adds abstract method for operator overloading<commit_after>#ifndef SETI_ABSTRACT_OBJ_H
#define SETI_ABSTRACT_OBJ_H

#include <string>
#include <memory>
#include <unordered_map>
#include <tuple>
#include <list>

#include "run_time_error.h"
#include "symbol_table.h"

namespace setti {
namespace internal {

class Executor;

class Object {
 public:
  enum class ObjectType: uint8_t {
    NIL,
    INT,
    BOOL,
    REAL,
    STRING,
    SLICE,
    ARRAY,
    MAP,
    TUPLE,
    FUNC,
    TYPE,
    CUSTON
  };

  virtual ~Object() {}

  inline ObjectType type() const {
    return type_;
  }

  virtual void Print() = 0;

  virtual std::size_t Hash() const = 0;

  virtual bool operator==(const Object& obj) const = 0;

  virtual bool ObjBool() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no bool interface"));
  }

  virtual bool ObjString() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no string interface"));
  }

  virtual bool ObjInt() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no int interface"));
  }

  virtual bool ObjCmd() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no cmd interface"));
  }

  virtual std::shared_ptr<Object> Add(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no + operator"));
  }

  virtual std::shared_ptr<Object> Sub(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no - operator"));
  }

  virtual std::shared_ptr<Object> Mult(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no * operator"));
  }

  virtual std::shared_ptr<Object> Div(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no / operator"));
  }

  virtual std::shared_ptr<Object> DivMod(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no % operator"));
  }

  virtual std::shared_ptr<Object> RightShift(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no >> operator"));
  }

  virtual std::shared_ptr<Object> LeftShift(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no << operator"));
  }

  virtual std::shared_ptr<Object> Lesser(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no < operator"));
  }

  virtual std::shared_ptr<Object> Greater(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no > operator"));
  }

  virtual std::shared_ptr<Object> Copy() const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no copy method"));
  }

  virtual std::shared_ptr<Object> LessEqual(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no >= operator"));
  }

  virtual std::shared_ptr<Object> GreatEqual(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no <= operator"));
  }

  virtual std::shared_ptr<Object> Equal(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no == operator"));
  }

  virtual std::shared_ptr<Object> NotEqual(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no == operator"));
  }

  virtual std::shared_ptr<Object> BitAnd(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no & operator"));
  }

  virtual std::shared_ptr<Object> BitOr(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no | operator"));
  }

  virtual std::shared_ptr<Object> BitXor(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no ^ operator"));
  }

  virtual std::shared_ptr<Object> BitNot(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no ~ operator"));
  }

  virtual std::shared_ptr<Object> And(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no && operator"));
  }

  virtual std::shared_ptr<Object> Or(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no && operator"));
  }

  virtual std::shared_ptr<Object> UnaryAdd(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no unary + operator"));
  }

  virtual std::shared_ptr<Object> UnarySub(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no unary - operator"));
  }

  virtual std::shared_ptr<Object> Not(std::shared_ptr<Object>) const {
    throw RunTimeError(RunTimeError::ErrorCode::INCOMPATIBLE_TYPE,
                       boost::format("type has no unary - operator"));
  }

  std::shared_ptr<Object> ObjType() const noexcept {
    return obj_type_;
  }

 private:
  // enum type
  ObjectType type_;

  // type of object, it is other object
  std::shared_ptr<Object> obj_type_;

  SymbolTableStack sym_table_;

 protected:
  Object(ObjectType type, std::shared_ptr<Object> obj_type,
         SymbolTableStack&& sym_table)
      : type_(type)
      , obj_type_(obj_type)
      , sym_table_(std::move(sym_table)){}
{'fraction_non_alphanumeric': 0.11888914390635759, 'fraction_numerical': 0.0009180628873077806, 'mean_word_length': 3.4396332144676514, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, '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': '3493145', 'n_tokens_mistral': 2681, 'n_tokens_neox': 2573, 'n_words': 535}