]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/tokenizer.h
Recognize the #line directive in the GLSL parser
[libs/gl.git] / source / glsl / tokenizer.h
index a7329182df53fcf5c8d7fd0cc844eb206c4f408f..20ea756a9099ea192368f60750f791e0238624c3 100644 (file)
@@ -15,6 +15,9 @@ struct Location
 {
        std::string name;
        unsigned line;
+
+       Location(): line(0) { }
+       Location(const std::string &n, unsigned l): name(n), line(l) { }
 };
 
 class Tokenizer
@@ -27,6 +30,7 @@ private:
        std::string::const_iterator source_end;
        Location location;
        bool allow_preprocess;
+       bool suppress_line_advance;
        std::string last_token;
        std::deque<std::string> next_tokens;
 
@@ -37,12 +41,14 @@ public:
        const std::string &peek_token(unsigned = 0);
        const std::string &parse_token();
        void expect(const std::string &);
+       void set_location(const Location &);
        const Location &get_location() const { return location; }
 private:
        std::string parse_token_();
        void preprocess();
        std::string parse_identifier();
        std::string parse_number();
+       std::string parse_string();
        std::string parse_other();
        void skip_comment_and_whitespace();
 };