X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Ftokenizer.h;h=26c4b93c683ac7316fff92fda8aa8ab082215298;hp=a7329182df53fcf5c8d7fd0cc844eb206c4f408f;hb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;hpb=d3ceb2186dc79130508093b3d0c944771a53534f diff --git a/source/glsl/tokenizer.h b/source/glsl/tokenizer.h index a7329182..26c4b93c 100644 --- a/source/glsl/tokenizer.h +++ b/source/glsl/tokenizer.h @@ -14,7 +14,10 @@ class Preprocessor; struct Location { std::string name; - unsigned line; + unsigned line = 0; + + Location() = default; + Location(const std::string &n, unsigned l): name(n), line(l) { } }; class Tokenizer @@ -26,7 +29,9 @@ private: std::string::const_iterator iter; std::string::const_iterator source_end; Location location; - bool allow_preprocess; + bool progress_mark = false; + bool allow_preprocess = true; + bool suppress_line_advance = false; std::string last_token; std::deque next_tokens; @@ -36,13 +41,18 @@ public: void begin(const std::string &, const std::string &); const std::string &peek_token(unsigned = 0); const std::string &parse_token(); + const std::string &get_last_token() const { return last_token; } void expect(const std::string &); + void set_location(const Location &); + void clear_progress_mark() { progress_mark = false; } + bool get_progress_mark() const { return progress_mark; } 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(); };