rip out a couple hundred lines of code with inheritance
This commit is contained in:
parent
1e867f5760
commit
8b35434e6f
@ -83,6 +83,8 @@ namespace chaiscript
|
||||
AST_Node(const std::string &ast_node_text, int id, const char *fname) :
|
||||
text(ast_node_text), identifier(id), filename(fname)/*, is_cached(false)*/ { }
|
||||
|
||||
virtual ~AST_Node() {}
|
||||
|
||||
/*
|
||||
void cache_const(const Boxed_Value &value) {
|
||||
this->cached_value = value;
|
||||
@ -115,282 +117,331 @@ namespace chaiscript
|
||||
}
|
||||
};
|
||||
|
||||
struct Binary_Operator_AST_Node : public AST_Node {
|
||||
public:
|
||||
Binary_Operator_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Xor, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Binary_Operator_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
|
||||
struct Error_AST_Node : public AST_Node {
|
||||
public:
|
||||
Error_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Error, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
|
||||
virtual ~Error_AST_Node() {}
|
||||
};
|
||||
struct Int_AST_Node : public AST_Node {
|
||||
public:
|
||||
Int_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Int, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Int_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Float_AST_Node : public AST_Node {
|
||||
public:
|
||||
Float_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Float, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Float_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Id_AST_Node : public AST_Node {
|
||||
public:
|
||||
Id_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Id, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Id_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Char_AST_Node : public AST_Node {
|
||||
public:
|
||||
Char_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Char, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Char_AST_Node() {}
|
||||
};
|
||||
struct Str_AST_Node : public AST_Node {
|
||||
public:
|
||||
Str_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Str, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Str_AST_Node() {}
|
||||
};
|
||||
struct Eol_AST_Node : public AST_Node {
|
||||
public:
|
||||
Eol_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Eol, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Eol_AST_Node() {}
|
||||
};
|
||||
struct Fun_Call_AST_Node : public AST_Node {
|
||||
public:
|
||||
Fun_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Fun_Call, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Fun_Call_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Inplace_Fun_Call_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inplace_Fun_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inplace_Fun_Call, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Inplace_Fun_Call_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Arg_List_AST_Node : public AST_Node {
|
||||
public:
|
||||
Arg_List_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Arg_List, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Arg_List_AST_Node() {}
|
||||
};
|
||||
struct Variable_AST_Node : public AST_Node {
|
||||
public:
|
||||
Variable_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Variable, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Variable_AST_Node() {}
|
||||
};
|
||||
struct Equation_AST_Node : public AST_Node {
|
||||
public:
|
||||
Equation_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Equation, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Equation_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Var_Decl_AST_Node : public AST_Node {
|
||||
public:
|
||||
Var_Decl_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Var_Decl, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Var_Decl_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Comparison_AST_Node : public AST_Node {
|
||||
struct Comparison_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Comparison_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Comparison, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Comparison_AST_Node() {}
|
||||
};
|
||||
struct Additive_AST_Node : public AST_Node {
|
||||
struct Additive_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Additive_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Additive, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Additive_AST_Node() {}
|
||||
};
|
||||
struct Multiplicative_AST_Node : public AST_Node {
|
||||
struct Multiplicative_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Multiplicative_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Multiplicative, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Multiplicative_AST_Node() {}
|
||||
};
|
||||
struct Array_Call_AST_Node : public AST_Node {
|
||||
public:
|
||||
Array_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Array_Call, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Array_Call_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Dot_Access_AST_Node : public AST_Node {
|
||||
public:
|
||||
Dot_Access_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Dot_Access, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Dot_Access_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Quoted_String_AST_Node : public AST_Node {
|
||||
public:
|
||||
Quoted_String_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Quoted_String, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Quoted_String_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Single_Quoted_String_AST_Node : public AST_Node {
|
||||
public:
|
||||
Single_Quoted_String_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Single_Quoted_String, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Single_Quoted_String_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Lambda_AST_Node : public AST_Node {
|
||||
public:
|
||||
Lambda_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Lambda, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Lambda_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Block_AST_Node : public AST_Node {
|
||||
public:
|
||||
Block_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Block, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Block_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Def_AST_Node : public AST_Node {
|
||||
public:
|
||||
Def_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Def, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Def_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct While_AST_Node : public AST_Node {
|
||||
public:
|
||||
While_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::While, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~While_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct If_AST_Node : public AST_Node {
|
||||
public:
|
||||
If_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::If, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~If_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct For_AST_Node : public AST_Node {
|
||||
public:
|
||||
For_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::For, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~For_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Inline_Array_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inline_Array_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Array, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Inline_Array_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Inline_Map_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inline_Map_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Map, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Inline_Map_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Return_AST_Node : public AST_Node {
|
||||
public:
|
||||
Return_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Return, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Return_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct File_AST_Node : public AST_Node {
|
||||
public:
|
||||
File_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::File, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~File_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Prefix_AST_Node : public AST_Node {
|
||||
public:
|
||||
Prefix_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Prefix, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Prefix_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Break_AST_Node : public AST_Node {
|
||||
public:
|
||||
Break_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Break, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Break_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Map_Pair_AST_Node : public AST_Node {
|
||||
public:
|
||||
Map_Pair_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Map_Pair, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Map_Pair_AST_Node() {}
|
||||
};
|
||||
struct Value_Range_AST_Node : public AST_Node {
|
||||
public:
|
||||
Value_Range_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Value_Range, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Value_Range_AST_Node() {}
|
||||
};
|
||||
struct Inline_Range_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inline_Range_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Range, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Inline_Range_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Annotation_AST_Node : public AST_Node {
|
||||
public:
|
||||
Annotation_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Annotation, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Annotation_AST_Node() {}
|
||||
};
|
||||
struct Try_AST_Node : public AST_Node {
|
||||
public:
|
||||
Try_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Try, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Try_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Catch_AST_Node : public AST_Node {
|
||||
public:
|
||||
Catch_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Catch, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Catch_AST_Node() {}
|
||||
};
|
||||
struct Finally_AST_Node : public AST_Node {
|
||||
public:
|
||||
Finally_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Finally, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Finally_AST_Node() {}
|
||||
};
|
||||
struct Method_AST_Node : public AST_Node {
|
||||
public:
|
||||
Method_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Method, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Method_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Attr_Decl_AST_Node : public AST_Node {
|
||||
public:
|
||||
Attr_Decl_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Attr_Decl, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Attr_Decl_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Shift_AST_Node : public AST_Node {
|
||||
struct Shift_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Shift_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Shift, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Shift_AST_Node() {}
|
||||
};
|
||||
struct Equality_AST_Node : public AST_Node {
|
||||
struct Equality_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Equality_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Equality, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Equality_AST_Node() {}
|
||||
};
|
||||
struct Bitwise_And_AST_Node : public AST_Node {
|
||||
struct Bitwise_And_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Bitwise_And_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_And, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Bitwise_And_AST_Node() {}
|
||||
};
|
||||
struct Bitwise_Xor_AST_Node : public AST_Node {
|
||||
struct Bitwise_Xor_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Bitwise_Xor_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Xor, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Bitwise_Xor_AST_Node() {}
|
||||
};
|
||||
struct Bitwise_Or_AST_Node : public AST_Node {
|
||||
struct Bitwise_Or_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Bitwise_Or_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Or, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Bitwise_Or_AST_Node() {}
|
||||
};
|
||||
struct Logical_And_AST_Node : public AST_Node {
|
||||
public:
|
||||
Logical_And_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Logical_And, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Logical_And_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Logical_Or_AST_Node : public AST_Node {
|
||||
public:
|
||||
Logical_Or_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Logical_Or, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
Boxed_Value eval(Dispatch_Engine &ss);
|
||||
virtual ~Logical_Or_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -347,196 +347,7 @@ namespace chaiscript
|
||||
/**
|
||||
* Evaluates comparison, additions, and multiplications and their relatives
|
||||
*/
|
||||
Boxed_Value Bitwise_And_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
try {
|
||||
retval = this->children[0]->eval(ss);
|
||||
}
|
||||
catch (Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[0]);
|
||||
throw;
|
||||
}
|
||||
|
||||
for (i = 1; i < this->children.size(); i += 2) {
|
||||
try {
|
||||
retval = ss.call_function(this->children[i]->text, retval, this->children[i+1]->eval(ss));
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate '" + this->children[i]->text + "'");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i+1]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
Boxed_Value Bitwise_Xor_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
try {
|
||||
retval = this->children[0]->eval(ss);
|
||||
}
|
||||
catch (Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[0]);
|
||||
throw;
|
||||
}
|
||||
|
||||
for (i = 1; i < this->children.size(); i += 2) {
|
||||
try {
|
||||
retval = ss.call_function(this->children[i]->text, retval, this->children[i+1]->eval(ss));
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate '" + this->children[i]->text + "'");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i+1]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
Boxed_Value Bitwise_Or_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
try {
|
||||
retval = this->children[0]->eval(ss);
|
||||
}
|
||||
catch (Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[0]);
|
||||
throw;
|
||||
}
|
||||
|
||||
for (i = 1; i < this->children.size(); i += 2) {
|
||||
try {
|
||||
retval = ss.call_function(this->children[i]->text, retval, this->children[i+1]->eval(ss));
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate '" + this->children[i]->text + "'");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i+1]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
Boxed_Value Additive_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
try {
|
||||
retval = this->children[0]->eval(ss);
|
||||
}
|
||||
catch (Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[0]);
|
||||
throw;
|
||||
}
|
||||
|
||||
for (i = 1; i < this->children.size(); i += 2) {
|
||||
try {
|
||||
retval = ss.call_function(this->children[i]->text, retval, this->children[i+1]->eval(ss));
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate '" + this->children[i]->text + "'");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i+1]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
Boxed_Value Multiplicative_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
try {
|
||||
retval = this->children[0]->eval(ss);
|
||||
}
|
||||
catch (Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[0]);
|
||||
throw;
|
||||
}
|
||||
|
||||
for (i = 1; i < this->children.size(); i += 2) {
|
||||
try {
|
||||
retval = ss.call_function(this->children[i]->text, retval, this->children[i+1]->eval(ss));
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate '" + this->children[i]->text + "'");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i+1]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
Boxed_Value Comparison_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
try {
|
||||
retval = this->children[0]->eval(ss);
|
||||
}
|
||||
catch (Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[0]);
|
||||
throw;
|
||||
}
|
||||
|
||||
for (i = 1; i < this->children.size(); i += 2) {
|
||||
try {
|
||||
retval = ss.call_function(this->children[i]->text, retval, this->children[i+1]->eval(ss));
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate '" + this->children[i]->text + "'");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i+1]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
Boxed_Value Equality_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
try {
|
||||
retval = this->children[0]->eval(ss);
|
||||
}
|
||||
catch (Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[0]);
|
||||
throw;
|
||||
}
|
||||
|
||||
for (i = 1; i < this->children.size(); i += 2) {
|
||||
try {
|
||||
retval = ss.call_function(this->children[i]->text, retval, this->children[i+1]->eval(ss));
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate '" + this->children[i]->text + "'");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i+1]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
Boxed_Value Shift_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
Boxed_Value Binary_Operator_AST_Node::eval(Dispatch_Engine &ss) {
|
||||
unsigned int i;
|
||||
Boxed_Value retval;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user