X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fparser.cpp;h=50948404921bd9903031946a8cc7f537ab37d1bc;hb=bbb5a5b00b4008684d5c32b3ea2fd21f7a5fad54;hp=1d225cb21d243c670dec03b29e5a4724cc47bd00;hpb=cbd0ddd6ee033e46646bfb85d19232c816ea1eda;p=libs%2Fdatafile.git diff --git a/source/parser.cpp b/source/parser.cpp index 1d225cb..5094840 100644 --- a/source/parser.cpp +++ b/source/parser.cpp @@ -1,11 +1,6 @@ -/* $Id$ - -This file is part of libmspdatafile -Copyright © 2006 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ -#include +#include #include "binaryparser.h" +#include "dataerror.h" #include "parser.h" #include "statement.h" #include "textparser.h" @@ -31,7 +26,7 @@ Parser::~Parser() Statement Parser::parse() { if(!good) - throw Exception("Parser is not good"); + throw logic_error("Parser::parse() !good"); try { @@ -48,6 +43,8 @@ Statement Parser::parse() delete mode; mode = new TextParser(in, src); } + else if(st.keyword=="__z") + in.set_decompress(); else if(st.keyword=="__src") { string s = st.args[0].get(); @@ -60,10 +57,13 @@ Statement Parser::parse() return st; } } - catch(const Exception &e) + catch(const exception &e) { good = false; - throw; + if(dynamic_cast(&e)) + throw; + else + throw data_error(src, in.get_line_number(), e); } }