X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramparser.h;h=be6da197481aa3d264c7516427b55859e40e04d9;hb=eb6a546dcffc1b67f0a23d8b075fbdc86a2872a0;hp=0a46c09ece6202e18c71625afd916b8680f4806a;hpb=57c1139e4fe21aeca7118b18eb3ba6fa43d7bf90;p=libs%2Fgl.git diff --git a/source/programparser.h b/source/programparser.h index 0a46c09e..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(); @@ -69,6 +75,7 @@ private: static bool is_interface_qualifier(const std::string &); static bool is_sampling_qualifier(const std::string &); + static bool is_precision_qualifier(const std::string &); static bool is_qualifier(const std::string &); static bool is_builtin_type(const std::string &); bool is_type(const std::string &); @@ -77,6 +84,7 @@ private: RefPtr parse_global_declaration(); RefPtr parse_statement(); RefPtr parse_import(); + RefPtr parse_precision(); RefPtr parse_layout(); void parse_block(ProgramSyntax::Block &, bool); RefPtr parse_expression(unsigned = 0);