Closing issue #99 : shared const char * memory issues. Also, clean up some file loading overhead (did not seem to have an performance impact).
This commit is contained in:
parent
e1e48d732f
commit
36173d277d
@ -105,6 +105,8 @@ target_link_libraries(reflection ${LIBS})
|
|||||||
|
|
||||||
file(GLOB UNIT_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/unittests/ ${CMAKE_CURRENT_SOURCE_DIR}/unittests/*.chai)
|
file(GLOB UNIT_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/unittests/ ${CMAKE_CURRENT_SOURCE_DIR}/unittests/*.chai)
|
||||||
|
|
||||||
|
list(SORT UNIT_TESTS)
|
||||||
|
|
||||||
IF(BUILD_TESTING)
|
IF(BUILD_TESTING)
|
||||||
option(UNIT_TEST_LIGHT "Unit tests light (expect module loading failures)" FALSE)
|
option(UNIT_TEST_LIGHT "Unit tests light (expect module loading failures)" FALSE)
|
||||||
|
|
||||||
|
@ -63,35 +63,22 @@ namespace chaiscript
|
|||||||
struct AST_Node {
|
struct AST_Node {
|
||||||
std::string text;
|
std::string text;
|
||||||
int identifier;
|
int identifier;
|
||||||
const char *filename;
|
boost::shared_ptr<std::string> filename;
|
||||||
File_Position start, end;
|
File_Position start, end;
|
||||||
/*
|
|
||||||
bool is_cached;
|
|
||||||
Boxed_Value cached_value;
|
|
||||||
*/
|
|
||||||
std::vector<AST_NodePtr> children;
|
std::vector<AST_NodePtr> children;
|
||||||
AST_NodePtr annotation;
|
AST_NodePtr annotation;
|
||||||
|
|
||||||
AST_Node(const std::string &ast_node_text, int id, const char *fname, int start_line, int start_col, int end_line, int end_col) :
|
AST_Node(const std::string &ast_node_text, int id, const boost::shared_ptr<std::string> &fname, int start_line, int start_col, int end_line, int end_col) :
|
||||||
text(ast_node_text), identifier(id), filename(fname)/*, is_cached(false)*/ {
|
text(ast_node_text), identifier(id), filename(fname),
|
||||||
|
start(start_line, start_col), end(end_line, end_col)
|
||||||
start.line = start_line;
|
{
|
||||||
start.column = start_col;
|
|
||||||
end.line = end_line;
|
|
||||||
end.column = end_col;
|
|
||||||
}
|
}
|
||||||
AST_Node(const std::string &ast_node_text, int id, const char *fname) :
|
|
||||||
text(ast_node_text), identifier(id), filename(fname)/*, is_cached(false)*/ { }
|
AST_Node(const std::string &ast_node_text, int id, const boost::shared_ptr<std::string> &fname) :
|
||||||
|
text(ast_node_text), identifier(id), filename(fname) {}
|
||||||
|
|
||||||
virtual ~AST_Node() {}
|
virtual ~AST_Node() {}
|
||||||
|
|
||||||
/*
|
|
||||||
void cache_const(const Boxed_Value &value) {
|
|
||||||
this->cached_value = value;
|
|
||||||
this->is_cached = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the contents of an AST node, including its children, recursively
|
* Prints the contents of an AST node, including its children, recursively
|
||||||
*/
|
*/
|
||||||
@ -127,12 +114,12 @@ namespace chaiscript
|
|||||||
std::string reason;
|
std::string reason;
|
||||||
File_Position start_position;
|
File_Position start_position;
|
||||||
File_Position end_position;
|
File_Position end_position;
|
||||||
const char *filename;
|
std::string filename;
|
||||||
std::vector<AST_NodePtr> call_stack;
|
std::vector<AST_NodePtr> call_stack;
|
||||||
|
|
||||||
Eval_Error(const std::string &why, const File_Position &where, const char *fname) :
|
Eval_Error(const std::string &why, const File_Position &where, const std::string &fname) :
|
||||||
std::runtime_error("Error: \"" + why + "\" " +
|
std::runtime_error("Error: \"" + why + "\" " +
|
||||||
(std::string(fname) != "__EVAL__" ? ("in '" + std::string(fname) + "' ") : "during evaluation ") +
|
(std::string(fname) != "__EVAL__" ? ("in '" + fname + "' ") : "during evaluation ") +
|
||||||
+ "at (" + boost::lexical_cast<std::string>(where.line) + ", " +
|
+ "at (" + boost::lexical_cast<std::string>(where.line) + ", " +
|
||||||
boost::lexical_cast<std::string>(where.column) + ")"),
|
boost::lexical_cast<std::string>(where.column) + ")"),
|
||||||
reason(why), start_position(where), end_position(where), filename(fname)
|
reason(why), start_position(where), end_position(where), filename(fname)
|
||||||
|
@ -236,10 +236,10 @@ namespace chaiscript
|
|||||||
/**
|
/**
|
||||||
* Evaluates the given string in by parsing it and running the results through the evaluator
|
* Evaluates the given string in by parsing it and running the results through the evaluator
|
||||||
*/
|
*/
|
||||||
Boxed_Value do_eval(const std::string &input, const std::string &filename = "__EVAL__", bool /* internal*/ = false) {
|
Boxed_Value do_eval(const std::string &input, const std::string &filename = "__EVAL__", bool /* internal*/ = false)
|
||||||
|
{
|
||||||
ChaiScript_Parser parser;
|
ChaiScript_Parser parser;
|
||||||
|
|
||||||
|
|
||||||
//debug_print(ast_nodes);
|
//debug_print(ast_nodes);
|
||||||
Boxed_Value value;
|
Boxed_Value value;
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ namespace chaiscript
|
|||||||
#endif
|
#endif
|
||||||
loaded_files.insert(filename);
|
loaded_files.insert(filename);
|
||||||
try {
|
try {
|
||||||
if (parser.parse(input, loaded_files.find(filename)->c_str())) {
|
if (parser.parse(input, *(loaded_files.find(filename)))) {
|
||||||
#ifndef CHAISCRIPT_NO_THREADS
|
#ifndef CHAISCRIPT_NO_THREADS
|
||||||
l.unlock();
|
l.unlock();
|
||||||
#endif
|
#endif
|
||||||
@ -270,7 +270,7 @@ namespace chaiscript
|
|||||||
#ifndef CHAISCRIPT_NO_THREADS
|
#ifndef CHAISCRIPT_NO_THREADS
|
||||||
boost::shared_lock<boost::shared_mutex> l(mutex);
|
boost::shared_lock<boost::shared_mutex> l(mutex);
|
||||||
#endif
|
#endif
|
||||||
const char *fname = loaded_files.find("__EVAL__")->c_str();
|
std::string fname = *(loaded_files.find("__EVAL__"));
|
||||||
#ifndef CHAISCRIPT_NO_THREADS
|
#ifndef CHAISCRIPT_NO_THREADS
|
||||||
l.unlock();
|
l.unlock();
|
||||||
#endif
|
#endif
|
||||||
@ -339,7 +339,8 @@ namespace chaiscript
|
|||||||
public:
|
public:
|
||||||
ChaiScript_System(const std::vector<std::string> &t_modulepaths = std::vector<std::string>(),
|
ChaiScript_System(const std::vector<std::string> &t_modulepaths = std::vector<std::string>(),
|
||||||
const std::vector<std::string> &t_usepaths = std::vector<std::string>())
|
const std::vector<std::string> &t_usepaths = std::vector<std::string>())
|
||||||
: modulepaths(t_modulepaths), usepaths(t_usepaths) {
|
: modulepaths(t_modulepaths), usepaths(t_usepaths)
|
||||||
|
{
|
||||||
if (modulepaths.empty())
|
if (modulepaths.empty())
|
||||||
{
|
{
|
||||||
modulepaths.push_back("");
|
modulepaths.push_back("");
|
||||||
@ -542,9 +543,7 @@ namespace chaiscript
|
|||||||
std::vector<char> v(static_cast<unsigned int>(size));
|
std::vector<char> v(static_cast<unsigned int>(size));
|
||||||
infile.read(&v[0], size);
|
infile.read(&v[0], size);
|
||||||
|
|
||||||
std::string ret_val (v.empty() ? std::string() : std::string (v.begin(), v.end()).c_str());
|
return std::string(v.begin(), v.end());
|
||||||
|
|
||||||
return ret_val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Binary_Operator_AST_Node : public AST_Node {
|
struct Binary_Operator_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Binary_Operator_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Xor, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Binary_Operator_AST_Node() {}
|
virtual ~Binary_Operator_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -78,7 +78,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Error_AST_Node : public AST_Node {
|
struct Error_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Error_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Error, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
|
|
||||||
virtual ~Error_AST_Node() {}
|
virtual ~Error_AST_Node() {}
|
||||||
@ -86,7 +86,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Int_AST_Node : public AST_Node {
|
struct Int_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Int_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Int, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Int_AST_Node() {}
|
virtual ~Int_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &){
|
virtual Boxed_Value eval(Dispatch_Engine &){
|
||||||
@ -97,7 +97,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Float_AST_Node : public AST_Node {
|
struct Float_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Float_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Float, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Float_AST_Node() {}
|
virtual ~Float_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &){
|
virtual Boxed_Value eval(Dispatch_Engine &){
|
||||||
@ -108,7 +108,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Id_AST_Node : public AST_Node {
|
struct Id_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Id_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Id, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Id_AST_Node() {}
|
virtual ~Id_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -137,28 +137,28 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Char_AST_Node : public AST_Node {
|
struct Char_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Char_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Char, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Char_AST_Node() {}
|
virtual ~Char_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Str_AST_Node : public AST_Node {
|
struct Str_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Str_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Str, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Str_AST_Node() {}
|
virtual ~Str_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Eol_AST_Node : public AST_Node {
|
struct Eol_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Eol_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Eol, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Eol_AST_Node() {}
|
virtual ~Eol_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Fun_Call_AST_Node : public AST_Node {
|
struct Fun_Call_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Fun_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Fun_Call, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Fun_Call_AST_Node() {}
|
virtual ~Fun_Call_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -213,7 +213,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Inplace_Fun_Call_AST_Node : public AST_Node {
|
struct Inplace_Fun_Call_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Inplace_Fun_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inplace_Fun_Call, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Inplace_Fun_Call_AST_Node() {}
|
virtual ~Inplace_Fun_Call_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -258,21 +258,21 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Arg_List_AST_Node : public AST_Node {
|
struct Arg_List_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Arg_List_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Arg_List, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Arg_List_AST_Node() {}
|
virtual ~Arg_List_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Variable_AST_Node : public AST_Node {
|
struct Variable_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Variable_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Variable, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Variable_AST_Node() {}
|
virtual ~Variable_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Equation_AST_Node : public AST_Node {
|
struct Equation_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Equation_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Equation, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Equation_AST_Node() {}
|
virtual ~Equation_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -348,7 +348,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Var_Decl_AST_Node : public AST_Node {
|
struct Var_Decl_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Var_Decl_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Var_Decl, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Var_Decl_AST_Node() {}
|
virtual ~Var_Decl_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -365,28 +365,28 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Comparison_AST_Node : public Binary_Operator_AST_Node {
|
struct Comparison_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Comparison_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Comparison, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Comparison_AST_Node() {}
|
virtual ~Comparison_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Additive_AST_Node : public Binary_Operator_AST_Node {
|
struct Additive_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Additive_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Additive, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Additive_AST_Node() {}
|
virtual ~Additive_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Multiplicative_AST_Node : public Binary_Operator_AST_Node {
|
struct Multiplicative_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Multiplicative_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Multiplicative, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Multiplicative_AST_Node() {}
|
virtual ~Multiplicative_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Array_Call_AST_Node : public AST_Node {
|
struct Array_Call_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Array_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Array_Call, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Array_Call_AST_Node() {}
|
virtual ~Array_Call_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -422,7 +422,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Dot_Access_AST_Node : public AST_Node {
|
struct Dot_Access_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Dot_Access_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Dot_Access, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Dot_Access_AST_Node() {}
|
virtual ~Dot_Access_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -508,7 +508,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Quoted_String_AST_Node : public AST_Node {
|
struct Quoted_String_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Quoted_String_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Quoted_String, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Quoted_String_AST_Node() {}
|
virtual ~Quoted_String_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &){
|
virtual Boxed_Value eval(Dispatch_Engine &){
|
||||||
@ -519,7 +519,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Single_Quoted_String_AST_Node : public AST_Node {
|
struct Single_Quoted_String_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Single_Quoted_String_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Single_Quoted_String, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Single_Quoted_String_AST_Node() {}
|
virtual ~Single_Quoted_String_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &){
|
virtual Boxed_Value eval(Dispatch_Engine &){
|
||||||
@ -530,7 +530,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Lambda_AST_Node : public AST_Node {
|
struct Lambda_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Lambda_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Lambda, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Lambda_AST_Node() {}
|
virtual ~Lambda_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -558,7 +558,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Block_AST_Node : public AST_Node {
|
struct Block_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Block_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Block, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Block_AST_Node() {}
|
virtual ~Block_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -598,7 +598,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Def_AST_Node : public AST_Node {
|
struct Def_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Def_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Def, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Def_AST_Node() {}
|
virtual ~Def_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -652,7 +652,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct While_AST_Node : public AST_Node {
|
struct While_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
While_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::While, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~While_AST_Node() {}
|
virtual ~While_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -707,7 +707,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct If_AST_Node : public AST_Node {
|
struct If_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
If_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::If, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~If_AST_Node() {}
|
virtual ~If_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -778,7 +778,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct For_AST_Node : public AST_Node {
|
struct For_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
For_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::For, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~For_AST_Node() {}
|
virtual ~For_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -889,7 +889,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Inline_Array_AST_Node : public AST_Node {
|
struct Inline_Array_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Inline_Array_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Array, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Inline_Array_AST_Node() {}
|
virtual ~Inline_Array_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -913,7 +913,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Inline_Map_AST_Node : public AST_Node {
|
struct Inline_Map_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Inline_Map_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Map, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Inline_Map_AST_Node() {}
|
virtual ~Inline_Map_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -940,7 +940,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Return_AST_Node : public AST_Node {
|
struct Return_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Return_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Return, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Return_AST_Node() {}
|
virtual ~Return_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -962,7 +962,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct File_AST_Node : public AST_Node {
|
struct File_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
File_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::File, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~File_AST_Node() {}
|
virtual ~File_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss) {
|
virtual Boxed_Value eval(Dispatch_Engine &ss) {
|
||||||
@ -985,7 +985,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Prefix_AST_Node : public AST_Node {
|
struct Prefix_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Prefix_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Prefix, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Prefix_AST_Node() {}
|
virtual ~Prefix_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -1001,7 +1001,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Break_AST_Node : public AST_Node {
|
struct Break_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Break_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Break, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Break_AST_Node() {}
|
virtual ~Break_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &){
|
virtual Boxed_Value eval(Dispatch_Engine &){
|
||||||
@ -1011,21 +1011,21 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Map_Pair_AST_Node : public AST_Node {
|
struct Map_Pair_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Map_Pair_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Map_Pair, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Map_Pair_AST_Node() {}
|
virtual ~Map_Pair_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Value_Range_AST_Node : public AST_Node {
|
struct Value_Range_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Value_Range_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Value_Range, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Value_Range_AST_Node() {}
|
virtual ~Value_Range_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Inline_Range_AST_Node : public AST_Node {
|
struct Inline_Range_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Inline_Range_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Range, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Inline_Range_AST_Node() {}
|
virtual ~Inline_Range_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -1047,14 +1047,14 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Annotation_AST_Node : public AST_Node {
|
struct Annotation_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Annotation_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Annotation, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Annotation_AST_Node() {}
|
virtual ~Annotation_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Try_AST_Node : public AST_Node {
|
struct Try_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Try_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Try, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Try_AST_Node() {}
|
virtual ~Try_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -1282,21 +1282,21 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Catch_AST_Node : public AST_Node {
|
struct Catch_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Catch_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Catch, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Catch_AST_Node() {}
|
virtual ~Catch_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Finally_AST_Node : public AST_Node {
|
struct Finally_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Finally_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Finally, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Finally_AST_Node() {}
|
virtual ~Finally_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Method_AST_Node : public AST_Node {
|
struct Method_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Method_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Method, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Method_AST_Node() {}
|
virtual ~Method_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -1373,7 +1373,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Attr_Decl_AST_Node : public AST_Node {
|
struct Attr_Decl_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Attr_Decl_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Attr_Decl, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Attr_Decl_AST_Node() {}
|
virtual ~Attr_Decl_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -1392,42 +1392,42 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Shift_AST_Node : public Binary_Operator_AST_Node {
|
struct Shift_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Shift_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Shift, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Shift_AST_Node() {}
|
virtual ~Shift_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Equality_AST_Node : public Binary_Operator_AST_Node {
|
struct Equality_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Equality_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Equality, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Equality_AST_Node() {}
|
virtual ~Equality_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Bitwise_And_AST_Node : public Binary_Operator_AST_Node {
|
struct Bitwise_And_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Bitwise_And_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_And, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Bitwise_And_AST_Node() {}
|
virtual ~Bitwise_And_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Bitwise_Xor_AST_Node : public Binary_Operator_AST_Node {
|
struct Bitwise_Xor_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Bitwise_Xor_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Xor, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Bitwise_Xor_AST_Node() {}
|
virtual ~Bitwise_Xor_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Bitwise_Or_AST_Node : public Binary_Operator_AST_Node {
|
struct Bitwise_Or_AST_Node : public Binary_Operator_AST_Node {
|
||||||
public:
|
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) :
|
Bitwise_Or_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Or, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Bitwise_Or_AST_Node() {}
|
virtual ~Bitwise_Or_AST_Node() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Logical_And_AST_Node : public AST_Node {
|
struct Logical_And_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Logical_And_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Logical_And, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Logical_And_AST_Node() {}
|
virtual ~Logical_And_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
@ -1469,7 +1469,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
struct Logical_Or_AST_Node : public AST_Node {
|
struct Logical_Or_AST_Node : public AST_Node {
|
||||||
public:
|
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) :
|
Logical_Or_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Logical_Or, const boost::shared_ptr<std::string> &fname=boost::shared_ptr<std::string>(), 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) { }
|
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||||
virtual ~Logical_Or_AST_Node() {}
|
virtual ~Logical_Or_AST_Node() {}
|
||||||
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
virtual Boxed_Value eval(Dispatch_Engine &ss){
|
||||||
|
@ -23,7 +23,7 @@ namespace chaiscript
|
|||||||
int line, col;
|
int line, col;
|
||||||
std::string multiline_comment_begin, multiline_comment_end;
|
std::string multiline_comment_begin, multiline_comment_end;
|
||||||
std::string singleline_comment;
|
std::string singleline_comment;
|
||||||
const char *filename;
|
boost::shared_ptr<std::string> filename;
|
||||||
std::vector<AST_NodePtr> match_stack;
|
std::vector<AST_NodePtr> match_stack;
|
||||||
|
|
||||||
std::vector<std::vector<std::string> > operator_matches;
|
std::vector<std::vector<std::string> > operator_matches;
|
||||||
@ -457,7 +457,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
while (has_more_input() && (*input_pos != '`')) {
|
while (has_more_input() && (*input_pos != '`')) {
|
||||||
if (Eol()) {
|
if (Eol()) {
|
||||||
throw Eval_Error("Carriage return in identifier literal", File_Position(line, col), filename);
|
throw Eval_Error("Carriage return in identifier literal", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
++input_pos;
|
++input_pos;
|
||||||
@ -466,10 +466,10 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start == input_pos) {
|
if (start == input_pos) {
|
||||||
throw Eval_Error("Missing contents of identifier literal", File_Position(line, col), filename);
|
throw Eval_Error("Missing contents of identifier literal", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
else if (input_pos == input_end) {
|
else if (input_pos == input_end) {
|
||||||
throw Eval_Error("Incomplete identifier literal", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete identifier literal", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
++col;
|
++col;
|
||||||
@ -573,7 +573,7 @@ namespace chaiscript
|
|||||||
++col;
|
++col;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw Eval_Error("Unclosed quoted string", File_Position(line, col), filename);
|
throw Eval_Error("Unclosed quoted string", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@ -665,7 +665,7 @@ namespace chaiscript
|
|||||||
build_match(AST_NodePtr(new Additive_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Additive_AST_Node()), prev_stack_top);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw Eval_Error("Unclosed in-string eval", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Unclosed in-string eval", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -694,7 +694,7 @@ namespace chaiscript
|
|||||||
case ('\'') : match.push_back('\''); break;
|
case ('\'') : match.push_back('\''); break;
|
||||||
case ('\"') : match.push_back('\"'); break;
|
case ('\"') : match.push_back('\"'); break;
|
||||||
case ('$') : match.push_back('$'); break;
|
case ('$') : match.push_back('$'); break;
|
||||||
default: throw Eval_Error("Unknown escaped sequence in string", File_Position(prev_line, prev_col), filename);
|
default: throw Eval_Error("Unknown escaped sequence in string", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*s == '$') {
|
else if (*s == '$') {
|
||||||
@ -759,7 +759,7 @@ namespace chaiscript
|
|||||||
++col;
|
++col;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw Eval_Error("Unclosed single-quoted string", File_Position(line, col), filename);
|
throw Eval_Error("Unclosed single-quoted string", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@ -801,7 +801,7 @@ namespace chaiscript
|
|||||||
case ('t') : match.push_back('\t'); break;
|
case ('t') : match.push_back('\t'); break;
|
||||||
case ('\'') : match.push_back('\''); break;
|
case ('\'') : match.push_back('\''); break;
|
||||||
case ('\"') : match.push_back('\"'); break;
|
case ('\"') : match.push_back('\"'); break;
|
||||||
default: throw Eval_Error("Unknown escaped sequence in string", File_Position(prev_line, prev_col), filename);
|
default: throw Eval_Error("Unknown escaped sequence in string", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -868,7 +868,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
if ((input_end - input_pos) >= len) {
|
if ((input_end - input_pos) >= len) {
|
||||||
std::string::const_iterator tmp = input_pos;
|
std::string::const_iterator tmp = input_pos;
|
||||||
for (size_t i = 0; i < len; ++i) {
|
for (int i = 0; i < len; ++i) {
|
||||||
if (*tmp != s[i]) {
|
if (*tmp != s[i]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1069,7 +1069,7 @@ namespace chaiscript
|
|||||||
do {
|
do {
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
if (!Equation()) {
|
if (!Equation()) {
|
||||||
throw Eval_Error("Unexpected value in parameter list", File_Position(line, col), filename);
|
throw Eval_Error("Unexpected value in parameter list", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
} while (retval && Char(','));
|
} while (retval && Char(','));
|
||||||
}
|
}
|
||||||
@ -1098,7 +1098,7 @@ namespace chaiscript
|
|||||||
do {
|
do {
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
if (!Map_Pair()) {
|
if (!Map_Pair()) {
|
||||||
throw Eval_Error("Unexpected value in container", File_Position(line, col), filename);
|
throw Eval_Error("Unexpected value in container", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
} while (retval && Char(','));
|
} while (retval && Char(','));
|
||||||
}
|
}
|
||||||
@ -1111,7 +1111,7 @@ namespace chaiscript
|
|||||||
do {
|
do {
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
if (!Operator()) {
|
if (!Operator()) {
|
||||||
throw Eval_Error("Unexpected value in container", File_Position(line, col), filename);
|
throw Eval_Error("Unexpected value in container", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
} while (retval && Char(','));
|
} while (retval && Char(','));
|
||||||
}
|
}
|
||||||
@ -1136,14 +1136,14 @@ namespace chaiscript
|
|||||||
if (Char('(')) {
|
if (Char('(')) {
|
||||||
Arg_List();
|
Arg_List();
|
||||||
if (!Char(')')) {
|
if (!Char(')')) {
|
||||||
throw Eval_Error("Incomplete anonymous function", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete anonymous function", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete anonymous function", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete anonymous function", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Lambda_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Lambda_AST_Node()), prev_stack_top);
|
||||||
@ -1174,7 +1174,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Id(true)) {
|
if (!Id(true)) {
|
||||||
throw Eval_Error("Missing function name in definition", File_Position(line, col), filename);
|
throw Eval_Error("Missing function name in definition", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Symbol("::", false)) {
|
if (Symbol("::", false)) {
|
||||||
@ -1182,14 +1182,14 @@ namespace chaiscript
|
|||||||
is_method = true;
|
is_method = true;
|
||||||
|
|
||||||
if (!Id(true)) {
|
if (!Id(true)) {
|
||||||
throw Eval_Error("Missing method name in definition", File_Position(line, col), filename);
|
throw Eval_Error("Missing method name in definition", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Char('(')) {
|
if (Char('(')) {
|
||||||
Arg_List();
|
Arg_List();
|
||||||
if (!Char(')')) {
|
if (!Char(')')) {
|
||||||
throw Eval_Error("Incomplete function definition", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete function definition", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1197,13 +1197,13 @@ namespace chaiscript
|
|||||||
|
|
||||||
if (Char(':')) {
|
if (Char(':')) {
|
||||||
if (!Operator()) {
|
if (!Operator()) {
|
||||||
throw Eval_Error("Missing guard expression for function", File_Position(line, col), filename);
|
throw Eval_Error("Missing guard expression for function", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete function definition", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete function definition", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_method) {
|
if (is_method) {
|
||||||
@ -1235,7 +1235,7 @@ namespace chaiscript
|
|||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'try' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'try' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_matches = true;
|
bool has_matches = true;
|
||||||
@ -1246,11 +1246,11 @@ namespace chaiscript
|
|||||||
size_t catch_stack_top = match_stack.size();
|
size_t catch_stack_top = match_stack.size();
|
||||||
if (Char('(')) {
|
if (Char('(')) {
|
||||||
if (!(Id(true) && Char(')'))) {
|
if (!(Id(true) && Char(')'))) {
|
||||||
throw Eval_Error("Incomplete 'catch' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'catch' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
if (Char(':')) {
|
if (Char(':')) {
|
||||||
if (!Operator()) {
|
if (!Operator()) {
|
||||||
throw Eval_Error("Missing guard expression for catch", File_Position(line, col), filename);
|
throw Eval_Error("Missing guard expression for catch", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1258,7 +1258,7 @@ namespace chaiscript
|
|||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'catch' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'catch' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
build_match(AST_NodePtr(new Catch_AST_Node()), catch_stack_top);
|
build_match(AST_NodePtr(new Catch_AST_Node()), catch_stack_top);
|
||||||
has_matches = true;
|
has_matches = true;
|
||||||
@ -1271,7 +1271,7 @@ namespace chaiscript
|
|||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'finally' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'finally' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
build_match(AST_NodePtr(new Finally_AST_Node()), finally_stack_top);
|
build_match(AST_NodePtr(new Finally_AST_Node()), finally_stack_top);
|
||||||
}
|
}
|
||||||
@ -1294,17 +1294,17 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Char('(')) {
|
if (!Char('(')) {
|
||||||
throw Eval_Error("Incomplete 'if' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'if' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(Operator() && Char(')'))) {
|
if (!(Operator() && Char(')'))) {
|
||||||
throw Eval_Error("Incomplete 'if' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'if' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'if' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'if' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_matches = true;
|
bool has_matches = true;
|
||||||
@ -1315,17 +1315,17 @@ namespace chaiscript
|
|||||||
if (Keyword("if")) {
|
if (Keyword("if")) {
|
||||||
match_stack.back()->text = "else if";
|
match_stack.back()->text = "else if";
|
||||||
if (!Char('(')) {
|
if (!Char('(')) {
|
||||||
throw Eval_Error("Incomplete 'else if' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'else if' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(Operator() && Char(')'))) {
|
if (!(Operator() && Char(')'))) {
|
||||||
throw Eval_Error("Incomplete 'else if' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'else if' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'else if' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'else if' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
has_matches = true;
|
has_matches = true;
|
||||||
}
|
}
|
||||||
@ -1333,7 +1333,7 @@ namespace chaiscript
|
|||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'else' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'else' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
has_matches = true;
|
has_matches = true;
|
||||||
}
|
}
|
||||||
@ -1358,17 +1358,17 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Char('(')) {
|
if (!Char('(')) {
|
||||||
throw Eval_Error("Incomplete 'while' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'while' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(Operator() && Char(')'))) {
|
if (!(Operator() && Char(')'))) {
|
||||||
throw Eval_Error("Incomplete 'while' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'while' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'while' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'while' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new While_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new While_AST_Node()), prev_stack_top);
|
||||||
@ -1387,7 +1387,7 @@ namespace chaiscript
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw Eval_Error("Incomplete conditions in 'for' loop", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete conditions in 'for' loop", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1403,17 +1403,17 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Char('(')) {
|
if (!Char('(')) {
|
||||||
throw Eval_Error("Incomplete 'for' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'for' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(For_Guards() && Char(')'))) {
|
if (!(For_Guards() && Char(')'))) {
|
||||||
throw Eval_Error("Incomplete 'for' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'for' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
throw Eval_Error("Incomplete 'for' block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'for' block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new For_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new For_AST_Node()), prev_stack_top);
|
||||||
@ -1435,7 +1435,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
Statements();
|
Statements();
|
||||||
if (!Char('}')) {
|
if (!Char('}')) {
|
||||||
throw Eval_Error("Incomplete block", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete block", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Block_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Block_AST_Node()), prev_stack_top);
|
||||||
@ -1499,7 +1499,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
Arg_List();
|
Arg_List();
|
||||||
if (!Char(')')) {
|
if (!Char(')')) {
|
||||||
throw Eval_Error("Incomplete function call", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete function call", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Fun_Call_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Fun_Call_AST_Node()), prev_stack_top);
|
||||||
@ -1508,7 +1508,7 @@ namespace chaiscript
|
|||||||
has_more = true;
|
has_more = true;
|
||||||
|
|
||||||
if (!(Operator() && Char(']'))) {
|
if (!(Operator() && Char(']'))) {
|
||||||
throw Eval_Error("Incomplete array access", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete array access", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Array_Call_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Array_Call_AST_Node()), prev_stack_top);
|
||||||
@ -1531,7 +1531,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Id(true)) {
|
if (!Id(true)) {
|
||||||
throw Eval_Error("Incomplete variable declaration", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete variable declaration", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Var_Decl_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Var_Decl_AST_Node()), prev_stack_top);
|
||||||
@ -1540,13 +1540,13 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Id(true)) {
|
if (!Id(true)) {
|
||||||
throw Eval_Error("Incomplete attribute declaration", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete attribute declaration", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
if (!Symbol("::", false)) {
|
if (!Symbol("::", false)) {
|
||||||
throw Eval_Error("Incomplete attribute declaration", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete attribute declaration", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
if (!Id(true)) {
|
if (!Id(true)) {
|
||||||
throw Eval_Error("Missing attribute name in definition", File_Position(line, col), filename);
|
throw Eval_Error("Missing attribute name in definition", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1565,10 +1565,10 @@ namespace chaiscript
|
|||||||
if (Char('(')) {
|
if (Char('(')) {
|
||||||
retval = true;
|
retval = true;
|
||||||
if (!Operator()) {
|
if (!Operator()) {
|
||||||
throw Eval_Error("Incomplete expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
if (!Char(')')) {
|
if (!Char(')')) {
|
||||||
throw Eval_Error("Missing closing parenthesis", File_Position(line, col), filename);
|
throw Eval_Error("Missing closing parenthesis", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@ -1586,7 +1586,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
Container_Arg_List();
|
Container_Arg_List();
|
||||||
if (!Char(']')) {
|
if (!Char(']')) {
|
||||||
throw Eval_Error("Missing closing square bracket", File_Position(line, col), filename);
|
throw Eval_Error("Missing closing square bracket", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
if ((prev_stack_top != match_stack.size()) && (match_stack.back()->children.size() > 0)) {
|
if ((prev_stack_top != match_stack.size()) && (match_stack.back()->children.size() > 0)) {
|
||||||
if (match_stack.back()->children[0]->identifier == AST_Node_Type::Value_Range) {
|
if (match_stack.back()->children[0]->identifier == AST_Node_Type::Value_Range) {
|
||||||
@ -1619,7 +1619,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Operator(operators.size()-1)) {
|
if (!Operator(operators.size()-1)) {
|
||||||
throw Eval_Error("Incomplete '++' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete '++' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
||||||
@ -1628,7 +1628,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Operator(operators.size()-1)) {
|
if (!Operator(operators.size()-1)) {
|
||||||
throw Eval_Error("Incomplete '--' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete '--' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
||||||
@ -1637,7 +1637,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Operator(operators.size()-1)) {
|
if (!Operator(operators.size()-1)) {
|
||||||
throw Eval_Error("Incomplete unary '-' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete unary '-' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
||||||
@ -1646,7 +1646,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Operator(operators.size()-1)) {
|
if (!Operator(operators.size()-1)) {
|
||||||
throw Eval_Error("Incomplete unary '+' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete unary '+' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
||||||
@ -1655,7 +1655,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Operator(operators.size()-1)) {
|
if (!Operator(operators.size()-1)) {
|
||||||
throw Eval_Error("Incomplete '!' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete '!' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
||||||
@ -1664,7 +1664,7 @@ namespace chaiscript
|
|||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
if (!Operator(operators.size()-1)) {
|
if (!Operator(operators.size()-1)) {
|
||||||
throw Eval_Error("Incomplete '~' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete '~' expression", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Prefix_AST_Node()), prev_stack_top);
|
||||||
@ -1707,7 +1707,7 @@ namespace chaiscript
|
|||||||
do {
|
do {
|
||||||
if (!Operator(precedence+1)) {
|
if (!Operator(precedence+1)) {
|
||||||
throw Eval_Error("Incomplete " + std::string(ast_node_type_to_string(operators[precedence])) + " expression",
|
throw Eval_Error("Incomplete " + std::string(ast_node_type_to_string(operators[precedence])) + " expression",
|
||||||
File_Position(line, col), filename);
|
File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
} while (Operator_Helper(precedence));
|
} while (Operator_Helper(precedence));
|
||||||
|
|
||||||
@ -1746,7 +1746,7 @@ namespace chaiscript
|
|||||||
build_match(AST_NodePtr(new Logical_Or_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Logical_Or_AST_Node()), prev_stack_top);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw Eval_Error("Internal error: unhandled ast_node", File_Position(line, col), filename);
|
throw Eval_Error("Internal error: unhandled ast_node", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1772,7 +1772,7 @@ namespace chaiscript
|
|||||||
if (Symbol(":")) {
|
if (Symbol(":")) {
|
||||||
retval = true;
|
retval = true;
|
||||||
if (!Operator()) {
|
if (!Operator()) {
|
||||||
throw Eval_Error("Incomplete map pair", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete map pair", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Map_Pair_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Map_Pair_AST_Node()), prev_stack_top);
|
||||||
@ -1803,7 +1803,7 @@ namespace chaiscript
|
|||||||
if (Symbol("..")) {
|
if (Symbol("..")) {
|
||||||
retval = true;
|
retval = true;
|
||||||
if (!Operator()) {
|
if (!Operator()) {
|
||||||
throw Eval_Error("Incomplete value range", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete value range", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Value_Range_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Value_Range_AST_Node()), prev_stack_top);
|
||||||
@ -1835,7 +1835,7 @@ namespace chaiscript
|
|||||||
Symbol("%=", true, true) || Symbol("<<=", true, true) || Symbol(">>=", true, true) ||
|
Symbol("%=", true, true) || Symbol("<<=", true, true) || Symbol(">>=", true, true) ||
|
||||||
Symbol("&=", true, true) || Symbol("^=", true, true) || Symbol("|=", true, true)) {
|
Symbol("&=", true, true) || Symbol("^=", true, true) || Symbol("|=", true, true)) {
|
||||||
if (!Equation()) {
|
if (!Equation()) {
|
||||||
throw Eval_Error("Incomplete equation", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete equation", File_Position(line, col), *filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new Equation_AST_Node()), prev_stack_top);
|
build_match(AST_NodePtr(new Equation_AST_Node()), prev_stack_top);
|
||||||
@ -1860,7 +1860,7 @@ namespace chaiscript
|
|||||||
int prev_col = col;
|
int prev_col = col;
|
||||||
if (Def()) {
|
if (Def()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1868,7 +1868,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else if (Try()) {
|
else if (Try()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1876,7 +1876,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else if (If()) {
|
else if (If()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1884,7 +1884,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else if (While()) {
|
else if (While()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1892,7 +1892,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else if (For()) {
|
else if (For()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two function definitions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1900,7 +1900,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else if (Return()) {
|
else if (Return()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two expressions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two expressions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1908,7 +1908,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else if (Break()) {
|
else if (Break()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two expressions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two expressions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1916,7 +1916,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
else if (Equation()) {
|
else if (Equation()) {
|
||||||
if (!saw_eol) {
|
if (!saw_eol) {
|
||||||
throw Eval_Error("Two expressions missing line separator", File_Position(prev_line, prev_col), filename);
|
throw Eval_Error("Two expressions missing line separator", File_Position(prev_line, prev_col), *filename);
|
||||||
}
|
}
|
||||||
has_more = true;
|
has_more = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -1943,11 +1943,12 @@ namespace chaiscript
|
|||||||
/**
|
/**
|
||||||
* Parses the given input string, tagging parsed ast_nodes with the given filename.
|
* Parses the given input string, tagging parsed ast_nodes with the given filename.
|
||||||
*/
|
*/
|
||||||
bool parse(const std::string &input, const char *fname) {
|
bool parse(const std::string &input, const std::string &fname) {
|
||||||
input_pos = input.begin();
|
input_pos = input.begin();
|
||||||
input_end = input.end();
|
input_end = input.end();
|
||||||
line = 1; col = 1;
|
line = 1;
|
||||||
filename = fname;
|
col = 1;
|
||||||
|
filename = boost::shared_ptr<std::string>(new std::string(fname));
|
||||||
|
|
||||||
if ((input.size() > 1) && (input[0] == '#') && (input[1] == '!')) {
|
if ((input.size() > 1) && (input[0] == '#') && (input[1] == '!')) {
|
||||||
while ((input_pos != input_end) && (!Eol())) {
|
while ((input_pos != input_end) && (!Eol())) {
|
||||||
|
@ -27,7 +27,7 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_reflect
|
|||||||
|
|
||||||
CHAISCRIPT_CLASS( m,
|
CHAISCRIPT_CLASS( m,
|
||||||
chaiscript::AST_Node,
|
chaiscript::AST_Node,
|
||||||
(chaiscript::AST_Node (const std::string &, int, char *)),
|
(chaiscript::AST_Node (const std::string &, int, const boost::shared_ptr<std::string> &)),
|
||||||
((text))
|
((text))
|
||||||
((identifier))
|
((identifier))
|
||||||
((filename))
|
((filename))
|
||||||
|
0
unittests/empty.chai
Normal file
0
unittests/empty.chai
Normal file
@ -1,7 +1,6 @@
|
|||||||
load_module("reflection")
|
load_module("reflection")
|
||||||
var fname = "INPUT"
|
|
||||||
var parser := ChaiScript_Parser()
|
var parser := ChaiScript_Parser()
|
||||||
var parse_success = parser.parse("3 + 4", fname.c_str())
|
var parse_success = parser.parse("3 + 4", "INPUT")
|
||||||
var a := parser.ast()
|
var a := parser.ast()
|
||||||
|
|
||||||
assert_equal(eval(a), 7)
|
assert_equal(eval(a), 7)
|
||||||
@ -12,3 +11,4 @@ var node := childs[0]
|
|||||||
node.text = "9"
|
node.text = "9"
|
||||||
|
|
||||||
assert_equal(eval(a), 13)
|
assert_equal(eval(a), 13)
|
||||||
|
assert_equal(node.filename, "INPUT")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user