123456789101112131415161718192021222324252627282930313233 |
- #ifndef TOKENSTREAM_H
- #define TOKENSTREAM_H
- #include <vector>
- #include "tokenizer/TokenType.h"
- class TokenStream final {
- public:
- TokenStream();
- bool hasToken() const;
- std::string nextTokenString();
-
- TokenType nextTokenType();
- unsigned int nextLine();
- std::string nextString();
- double nextDouble();
- void add(TokenType type, unsigned int line);
- void add(TokenType type, unsigned int line, double d);
- void add(TokenType type, unsigned int line, const std::string& text);
- private:
- void write(const void* data, size_t length);
- void read(void* data, size_t length);
- private:
- size_t nextToken;
- std::vector<char> bytes;
- };
- #endif
|