X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinaryparser.cpp;fp=source%2Fbinaryparser.cpp;h=fd918758294fd6c1d66ac497af5d5674d629c691;hb=9867e5fdf99d7d6c9d83846c11a1cee6a9919be1;hp=fa99a7e47708ba3c1d4991c16d605d9ae77c7b28;hpb=19179a622c1de88de5ed7047643eec79f285bf2a;p=libs%2Fdatafile.git diff --git a/source/binaryparser.cpp b/source/binaryparser.cpp index fa99a7e..fd91875 100644 --- a/source/binaryparser.cpp +++ b/source/binaryparser.cpp @@ -39,20 +39,25 @@ Statement BinaryParser::parse() Statement st = parse_statement(); if(st.keyword=="__kwd") { - if(st.args.size()!=3) + int id = st.args[0].get(); + if(id<=0) throw bad_definition("__kwd"); - const int id = st.args[0].get(); const string &kw = st.args[1].get(); const string &args = st.args[2].get(); + 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") { - if(st.args.size()!=2) + int id = st.args[0].get(); + if(id<=0) throw bad_definition("__str"); - const unsigned id = st.args[0].get(); strings[id] = st.args[1].get(); } else if(st.keyword=="__flt")