/* $Id$
This file is part of libmspdatafile
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2008 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
*/
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<unsigned>();
const string &kw=st.args[1].get<const string &>();
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<unsigned>();
strings[id]=st.args[1].get<const string &>();
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;
{
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;
}