X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fparser.h;h=c98867a3791e866ecd31a9c7cc5076e7443482cf;hb=3a1fe833ea04df75449706f1d773f6e65521a392;hp=acfb7d9eed9a8cc857becf5436e59a92bac522ba;hpb=7b73b63df12b3ace4231842aa291d6e1d7b3f948;p=libs%2Fgl.git diff --git a/source/glsl/parser.h b/source/glsl/parser.h index acfb7d9e..c98867a3 100644 --- a/source/glsl/parser.h +++ b/source/glsl/parser.h @@ -16,8 +16,8 @@ class Parser { private: std::string source; - unsigned base_index; - unsigned source_index; + int base_index; + int source_index; Tokenizer tokenizer; Preprocessor preprocessor; bool allow_stage_change; @@ -30,11 +30,11 @@ 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 &, unsigned); + 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); @@ -50,7 +50,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 &); @@ -60,18 +59,25 @@ private: void preprocess_pragma_msp(); void preprocess_stage(); - RefPtr parse_global_declaration(); + template + RefPtr create_node(); template RefPtr parse_with_recovery(RefPtr (Parser::*)()); + RefPtr parse_global_declaration(); RefPtr parse_statement(); RefPtr parse_import(); RefPtr parse_precision(); RefPtr parse_layout(); template void parse_block(Block &, bool, RefPtr (Parser::*)()); - RefPtr parse_expression(unsigned = 0); - RefPtr parse_binary(const RefPtr &, const Operator *); + 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();