X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramparser.h;h=be6da197481aa3d264c7516427b55859e40e04d9;hb=eb6a546dcffc1b67f0a23d8b075fbdc86a2872a0;hp=927c02046fb822d17e67dcc0b8ecdfbe03bafc9f;hpb=a5772e203cc30ce3b449614d03a293fd5b5985ad;p=libs%2Fgl.git diff --git a/source/programparser.h b/source/programparser.h index 927c0204..be6da197 100644 --- a/source/programparser.h +++ b/source/programparser.h @@ -37,7 +37,10 @@ private: }; std::string source; + std::string source_name; + unsigned current_line; std::string::const_iterator iter; + std::string last_token; std::deque next_tokens; ProgramSyntax::Module *module; ProgramSyntax::Stage *cur_stage; @@ -49,14 +52,17 @@ public: ProgramParser(); ~ProgramParser(); - ProgramSyntax::Module &parse(const std::string &); - ProgramSyntax::Module &parse(IO::Base &); + ProgramSyntax::Module &parse(const std::string &, const std::string &); + ProgramSyntax::Module &parse(IO::Base &, const std::string &); private: void parse_source(); + std::string format_error(const std::string &); + std::string format_syntax_error(const std::string &); + const std::string &peek_token(unsigned = 0); - std::string parse_token(); + const std::string &parse_token(); std::string parse_token_(); std::string parse_identifier(); std::string parse_number();