X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fparser.h;h=51616378c29c947653496ca71be80640081e55f4;hp=13ec0ab9a1f8de2f0acdd279e3a4bef1ed35403e;hb=77f6973f58167d94059d3f324c29ab2ca8de4544;hpb=fd44325059d59d32d47ef3feb6d41d846f7f36f0 diff --git a/source/glsl/parser.h b/source/glsl/parser.h index 13ec0ab9..51616378 100644 --- a/source/glsl/parser.h +++ b/source/glsl/parser.h @@ -12,9 +12,12 @@ namespace Msp { namespace GL { namespace SL { +class ModuleCache; + class Parser { private: + ModuleCache *mod_cache; std::string source; int base_index; int source_index; @@ -22,16 +25,18 @@ private: Preprocessor preprocessor; bool allow_stage_change; Module *module; + std::vector imported_modules; Stage *cur_stage; - std::set declared_types; + std::set global_types; + std::set stage_types; std::vector errors; + RefPtr next_global_declaration; public: - Parser(); - ~Parser(); + Parser(ModuleCache *); - Module &parse(const std::string &, const std::string &, int); - Module &parse(IO::Base &, const std::string &, int); + void parse(Module &, const std::string &, const std::string &, int); + void parse(Module &, IO::Base &, const std::string &, int); private: void parse_source(const std::string &, int); @@ -70,10 +75,12 @@ private: RefPtr parse_layout(); template void parse_block(Block &, bool, RefPtr (Parser::*)()); - RefPtr parse_expression(unsigned = 0); + RefPtr parse_expression(const Operator * = 0); RefPtr parse_literal(); RefPtr parse_binary(const RefPtr &, const Operator &); + RefPtr parse_ternary(const RefPtr &, const Operator &); RefPtr parse_function_call(const VariableReference &); + void add_type(TypeDeclaration &); RefPtr parse_type_declaration(); RefPtr parse_basic_type_declaration(); RefPtr parse_image_type_declaration(); @@ -81,7 +88,7 @@ private: RefPtr parse_variable_declaration(); RefPtr parse_variable_declaration_with_layout(); RefPtr parse_function_declaration(); - RefPtr parse_interface_block(); + RefPtr parse_interface_block(); RefPtr parse_conditional(); RefPtr parse_for(); RefPtr parse_while();