I don't see how the original conditions could ever have been triggered,
given that arguments are parsed based on the signature, and those of the
built-in statements are fixed.
Statement st = parse_statement();
if(st.keyword=="__kwd")
{
Statement st = parse_statement();
if(st.keyword=="__kwd")
{
+ int id = st.args[0].get<int>();
+ if(id<=0)
throw bad_definition("__kwd");
throw bad_definition("__kwd");
- const int id = st.args[0].get<unsigned>();
const string &kw = st.args[1].get<const string &>();
const string &args = st.args[2].get<const string &>();
const string &kw = st.args[1].get<const string &>();
const string &args = st.args[2].get<const string &>();
+ for(string::const_iterator i=args.begin(); i!=args.end(); ++i)
+ for(unsigned j=0; valid_signatures[j]!=*i; ++j)
+ if(!valid_signatures[j])
+ throw bad_definition("__kwd");
+
dict[id] = DictEntry(kw, args);
}
else if(st.keyword=="__str")
{
dict[id] = DictEntry(kw, args);
}
else if(st.keyword=="__str")
{
+ int id = st.args[0].get<int>();
+ if(id<=0)
throw bad_definition("__str");
throw bad_definition("__str");
- const unsigned id = st.args[0].get<unsigned>();
strings[id] = st.args[1].get<const string &>();
}
else if(st.keyword=="__flt")
strings[id] = st.args[1].get<const string &>();
}
else if(st.keyword=="__flt")
+const char valid_signatures[] =
+{
+ IntType::signature,
+ FloatType::signature,
+ BoolType::signature,
+ StringType::signature,
+ SymbolType::signature,
+ 0
+};
+
template<typename T>
struct HasLoadType
{
template<typename T>
struct HasLoadType
{