]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/parser.h
Store a pointer to operator info rather than the token in expressions
[libs/gl.git] / source / glsl / parser.h
index 9ab1232aaa0d9ad7aec82b24ee873b8b4e998e16..376ccc6cd77fa996d02aeff1aa0baf59aea6167b 100644 (file)
@@ -16,24 +16,25 @@ 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;
        Module *module;
        Stage *cur_stage;
        std::set<std::string> declared_types;
+       std::vector<std::string> 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 &, 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);
@@ -60,6 +61,8 @@ private:
        void preprocess_stage();
 
        RefPtr<Statement> parse_global_declaration();
+       template<typename T>
+       RefPtr<T> parse_with_recovery(RefPtr<T> (Parser::*)());
        RefPtr<Statement> parse_statement();
        RefPtr<Import> parse_import();
        RefPtr<Precision> parse_precision();
@@ -67,7 +70,7 @@ private:
        template<typename T>
        void parse_block(Block &, bool, RefPtr<T> (Parser::*)());
        RefPtr<Expression> parse_expression(unsigned = 0);
-       RefPtr<BinaryExpression> parse_binary(const RefPtr<Expression> &, const Operator *);
+       RefPtr<BinaryExpression> parse_binary(const RefPtr<Expression> &, const Operator &);
        RefPtr<FunctionCall> parse_function_call(const VariableReference &);
        RefPtr<StructDeclaration> parse_struct_declaration();
        RefPtr<VariableDeclaration> parse_variable_declaration();