X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FParser.h;h=fd8f2cfad52fd3d536fc1b013268d60e72de4f1d;hb=401785f03e9d56fb28d9e29cdb74dbbf5664c342;hp=b4f1b8d270b17ff93a02e2388bec310d0609743c;hpb=8d3decb97c252bc7b0ba4b9b5def0b04dfcb8e00;p=l2e.git diff --git a/src/loader/Parser.h b/src/loader/Parser.h index b4f1b8d..fd8f2cf 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 std::string &file, ParsedSource &product); ~Parser() { } private: Parser(const Parser &); @@ -39,12 +38,13 @@ public: public: class Error: public std::runtime_error { public: - Error(const char *file, int line, const std::string &msg) + Error(const std::string &file, int line, const std::string &msg) : std::runtime_error(msg), file(file), line(line) { }; - const char *File() const { return file; } + ~Error() throw() { } + const std::string &File() const { return file; } int Line() const { return line; } private: - const char *file; + std::string file; int line; }; @@ -71,10 +71,12 @@ private: void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected); void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected, const std::string &msg); bool BeginningOfLiteral(const Tokenizer::Token &) const; + bool BeginningOfPrimitiveLiteral(const Tokenizer::Token &) const; bool BeginOfPropertyList(const Tokenizer::Token &) const; private: - const char *file; + std::string file; + std::string dirname; std::ifstream in; Tokenizer tok; ParsedSource &product;