X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fparser.h;h=376ccc6cd77fa996d02aeff1aa0baf59aea6167b;hb=19a24f859cd7fcf581442319499ae24b3e7385a4;hp=b6c8369debb91d379e66d8f1a2afda5f2e53bea9;hpb=7a16308e72aef363727b21348779673edf8e5c07;p=libs%2Fgl.git diff --git a/source/glsl/parser.h b/source/glsl/parser.h index b6c8369d..376ccc6c 100644 --- a/source/glsl/parser.h +++ b/source/glsl/parser.h @@ -16,29 +16,33 @@ class Parser { private: std::string source; - std::string source_name; - unsigned source_index; + int base_index; + int source_index; Tokenizer tokenizer; Preprocessor preprocessor; bool allow_stage_change; Module *module; Stage *cur_stage; std::set declared_types; + std::vector errors; public: Parser(); ~Parser(); - Module &parse(const std::string &, const std::string &, unsigned = 0); - Module &parse(IO::Base &, const std::string &, unsigned = 0); + Module &parse(const std::string &, const std::string &, int); + Module &parse(IO::Base &, const std::string &, int); private: - void parse_source(const std::string &); + void parse_source(const std::string &, int); void set_required_version(const Version &); + void source_reference(unsigned, const std::string &); void stage_change(Stage::Type); + void line_change(int, unsigned); std::string expect_type(); std::string expect_identifier(); + int expect_integer(); bool check(const std::string &); static bool is_interface_qualifier(const std::string &); @@ -57,16 +61,20 @@ private: void preprocess_stage(); RefPtr parse_global_declaration(); + template + RefPtr parse_with_recovery(RefPtr (Parser::*)()); RefPtr parse_statement(); RefPtr parse_import(); RefPtr parse_precision(); RefPtr parse_layout(); - void parse_block(Block &, bool); + template + void parse_block(Block &, bool, RefPtr (Parser::*)()); RefPtr parse_expression(unsigned = 0); - RefPtr parse_binary(const RefPtr &, const Operator *); + RefPtr parse_binary(const RefPtr &, const Operator &); RefPtr parse_function_call(const VariableReference &); RefPtr parse_struct_declaration(); RefPtr parse_variable_declaration(); + RefPtr parse_variable_declaration_with_layout(); RefPtr parse_function_declaration(); RefPtr parse_interface_block(); RefPtr parse_conditional();