X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fparser.h;h=a935356ecd1339e68e6bb82f2752a5d47e6a25fb;hp=21d86e9d488d875f6c09d5b9687ba26c9ed1986d;hb=241cf36a6d7735706804bb3c517529bbe078f1ee;hpb=a82fcc462550d63a101aca4313807b1320789a5a diff --git a/source/glsl/parser.h b/source/glsl/parser.h index 21d86e9d..a935356e 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,17 @@ 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; 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); @@ -50,7 +54,6 @@ private: static bool is_interpolation_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 &); bool is_identifier(const std::string &); @@ -71,9 +74,14 @@ 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 &); + RefPtr parse_type_declaration(); + RefPtr parse_basic_type_declaration(); + RefPtr parse_image_type_declaration(); RefPtr parse_struct_declaration(); RefPtr parse_variable_declaration(); RefPtr parse_variable_declaration_with_layout();