X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinaryparser.cpp;h=40736896c01bf13aaa789b2033050cbda5b338fc;hb=256f7238bc60d6dcc31a564988f5cc02a60c4537;hp=214c35e70d3793437e786f90d0f99fd60a1fbd66;hpb=d84673be1c2fe8bd32ddaa7877529855cad6daa0;p=libs%2Fdatafile.git diff --git a/source/binaryparser.cpp b/source/binaryparser.cpp index 214c35e..4073689 100644 --- a/source/binaryparser.cpp +++ b/source/binaryparser.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of libmspdatafile -Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Copyright © 2007-2008 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ @@ -31,7 +31,7 @@ Statement BinaryParser::parse() if(st.keyword=="__kwd") { if(st.args.size()!=3) - throw TypeError(src+": Keyword definition must have three arguments"); + throw_at(TypeError("Keyword definition must have three arguments"), src); const unsigned id=st.args[0].get(); const string &kw=st.args[1].get(); @@ -41,7 +41,7 @@ Statement BinaryParser::parse() else if(st.keyword=="__str") { if(st.args.size()!=2) - throw TypeError(src+": String definition must have two arguments"); + throw_at(TypeError("String definition must have two arguments"), src); const unsigned id=st.args[0].get(); strings[id]=st.args[1].get(); @@ -63,7 +63,7 @@ Statement BinaryParser::parse_statement() Dictionary::const_iterator i=dict.find(id); if(i==dict.end()) - throw ParseError(format("%s: Unknown statement ID %d", src, id), src, 0); + throw_at(KeyError("Unknown statement ID", lexical_cast(id)), src); const DictEntry &de=i->second; Statement result; @@ -171,7 +171,7 @@ const string &BinaryParser::lookup_string(unsigned id) const { StringMap::const_iterator i=strings.find(id); if(i==strings.end()) - throw KeyError("Unknown string", lexical_cast(id)); + throw_at(KeyError("Unknown string", lexical_cast(id)), src); return i->second; }