From: Daniel Karbach Date: Fri, 31 Aug 2012 21:31:55 +0000 (+0200) Subject: added error message for unreadable files in Parser X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=322be5954c0f8df6a9e3aaeb2456783a814d52c3;hp=d53df1f79242df61b2305d148699d25a9c838eaa;p=l2e.git added error message for unreadable files in Parser --- diff --git a/src/loader/Parser.cpp b/src/loader/Parser.cpp index 6ced1be..d6abcc3 100644 --- a/src/loader/Parser.cpp +++ b/src/loader/Parser.cpp @@ -17,6 +17,16 @@ using std::vector; namespace loader { +Parser::Parser(const char *file, ParsedSource &product) +: file(file) +, in(file) +, tok(in) +, product(product) { + if (!in) { + throw Error(file, 0, "unable to read file"); + } +} + void Parser::Parse() { while (tok.HasMore()) { ParseStatement(); diff --git a/src/loader/Parser.h b/src/loader/Parser.h index b4f1b8d..9e4cbf4 100644 --- a/src/loader/Parser.h +++ b/src/loader/Parser.h @@ -26,8 +26,7 @@ class PropertyList; class Parser { public: - Parser(const char *file, ParsedSource &product) - : file(file), in(file), tok(in), product(product) { } + Parser(const char *file, ParsedSource &product); ~Parser() { } private: Parser(const Parser &);