]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programparser.h
Add file and line information to ProgramParser errors
[libs/gl.git] / source / programparser.h
index 927c02046fb822d17e67dcc0b8ecdfbe03bafc9f..be6da197481aa3d264c7516427b55859e40e04d9 100644 (file)
@@ -37,7 +37,10 @@ private:
        };
 
        std::string source;
+       std::string source_name;
+       unsigned current_line;
        std::string::const_iterator iter;
+       std::string last_token;
        std::deque<std::string> next_tokens;
        ProgramSyntax::Module *module;
        ProgramSyntax::Stage *cur_stage;
@@ -49,14 +52,17 @@ public:
        ProgramParser();
        ~ProgramParser();
 
-       ProgramSyntax::Module &parse(const std::string &);
-       ProgramSyntax::Module &parse(IO::Base &);
+       ProgramSyntax::Module &parse(const std::string &, const std::string &);
+       ProgramSyntax::Module &parse(IO::Base &, const std::string &);
 
 private:
        void parse_source();
 
+       std::string format_error(const std::string &);
+       std::string format_syntax_error(const std::string &);
+
        const std::string &peek_token(unsigned = 0);
-       std::string parse_token();
+       const std::string &parse_token();
        std::string parse_token_();
        std::string parse_identifier();
        std::string parse_number();