#ifndef TOKENSTREAM_H_ #define TOKENSTREAM_H_ #include #include class TokenStream; class TokenPoint { public: TokenPoint(TokenStream& S); ~TokenPoint(); bool accept(); bool reject(); private: TokenPoint& operator=(const TokenPoint&) { return *this; } TokenStream& Stream; unsigned int Pos; }; class TokenStream { public: TokenStream(); TokenStream(const std::string& Input); bool eos() const; bool eosButWhite(); std::string makeFileName(); std::string cIdentifier(); std::string cToken(); std::string cString(); bool whiteSpace(); bool literal(const std::string& S); void error(const std::string& Err); unsigned int errors() const; private: bool literal(char c); bool alpha(); bool numeric(); std::string Content; std::vector LineNo; unsigned int Index; unsigned int Errors; friend class TokenPoint; }; #endif