/* * Character stream handler : header file * */ #include #include using namespace std; const char EOF_CHAR = EOF; const char L_CURLY = '{'; const char R_CURLY = '}'; const char BLANK = ' '; const char TAB = '\t'; const char EOL_CHAR = '\0'; const char VALID_CHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.,;:<>/*[]+-=(){\t "; class CharStream : protected ifstream { private: int Current_Char; // index of the current character in line buffer bool fOpened; // true if the stream is open void SkipWhite(void); void SkipComment(void); void GetNewLine(); void Advance(void); bool Valid(char c); stack CharStack; public: CharStream(); CharStream(const char filename[]); virtual ~CharStream(); bool Open(const char filename[]); void Close(void); char CurrentChar(void); void Push_back(char LookAhead); };