X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fparser.cpp;h=50948404921bd9903031946a8cc7f537ab37d1bc;hb=bbb5a5b00b4008684d5c32b3ea2fd21f7a5fad54;hp=957018f7a35c1e302e659da5f4ac5650f14aeca6;hpb=7df5e45c7f414f6a07681dc4ec2abb63b091a309;p=libs%2Fdatafile.git diff --git a/source/parser.cpp b/source/parser.cpp index 957018f..5094840 100644 --- a/source/parser.cpp +++ b/source/parser.cpp @@ -1,5 +1,6 @@ -#include +#include #include "binaryparser.h" +#include "dataerror.h" #include "parser.h" #include "statement.h" #include "textparser.h" @@ -25,7 +26,7 @@ Parser::~Parser() Statement Parser::parse() { if(!good) - throw Exception("Parser is not good"); + throw logic_error("Parser::parse() !good"); try { @@ -42,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(); @@ -54,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); } }