#include <fstream>
#include <map>
-#include <msp/error.h>
+#include "error.h"
#include "parser.h"
#include "statement.h"
#include "value.h"
LoaderFunc0(FuncType f): func(f) { }
void execute(Loader &l, const Statement &st) const
{
- if(st.args.size()!=0) throw TypeError("Wrong number of arguments");
+ if(st.args.size()!=0) throw TypeError(st.get_location()+": Wrong number of arguments");
(dynamic_cast<L &>(l).*func)();
};
private:
LoaderFunc1(FuncType f): func(f) { }
void execute(Loader &l, const Statement &st) const
{
- if(st.args.size()!=1) throw TypeError("Wrong number of arguments");
+ if(st.args.size()!=1) throw TypeError(st.get_location()+": Wrong number of arguments");
(dynamic_cast<L &>(l).*func)(st.args[0].get<A0>());
}
private:
LoaderFunc2(FuncType f): func(f) { }
void execute(Loader &l, const Statement &st) const
{
- if(st.args.size()!=2) throw TypeError("Wrong number of arguments");
+ if(st.args.size()!=2) throw TypeError(st.get_location()+": Wrong number of arguments");
(dynamic_cast<L &>(l).*func)(st.args[0].get<A0>(), st.args[1].get<A1>());
}
private:
LoaderFunc3(FuncType f): func(f) { }
void execute(Loader &l, const Statement &st) const
{
- if(st.args.size()!=3) throw TypeError("Wrong number of arguments");
+ if(st.args.size()!=3) throw TypeError(st.get_location()+": Wrong number of arguments");
(dynamic_cast<L &>(l).*func)(st.args[0].get<A0>(), st.args[1].get<A1>(), st.args[2].get<A2>());
}
private:
LoaderFunc4(FuncType f): func(f) { }
void execute(Loader &l, const Statement &st) const
{
- if(st.args.size()!=4) throw TypeError("Wrong number of arguments");
+ if(st.args.size()!=4) throw TypeError(st.get_location()+": Wrong number of arguments");
(dynamic_cast<L &>(l).*func)(st.args[0].get<A0>(), st.args[1].get<A1>(), st.args[2].get<A2>(), st.args[3].get<A3>());
}
private:
LoadValue(PointerType p): ptr(p) { }
void execute(Loader &l, const Statement &st) const
{
- if(st.args.size()!=1) throw TypeError("Wrong number of arguments");
+ if(st.args.size()!=1) throw TypeError(st.get_location()+": Wrong number of arguments");
dynamic_cast<typename L::Loader &>(l).get_object().*ptr=st.args[0].get<T>();
}
private: