⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inputstream.h

📁 用于词法分析的词法分析器
💻 H
字号:
/*  $Id: InputStream.h,v 1.2 1996/05/25 01:37:34 matt Exp $  Input streams class.    Provides higher-level view of an istream-derived object, including  line, column information and meta-state information (word boundary,  line end, etc.)    (c) Jan 96 Matt Phillips.  */#ifndef _INPUTSTR_H#define _INPUTSTR_H#include <iostream.h>#include <std/string.h>class InputStream{public:  enum {EOFChar = -1};  // bit values for state  enum {stClear = 0x00, stWdBoundary = 0x01, stBegLine = 0x02,	stEndLine = 0x04};  InputStream (istream &s, string &fname);  InputStream (istream &s);  InputStream (const InputStream &s);  virtual ~InputStream () {}  string filename;  int line, col;  int eof () const {return current == EOFChar;}  int peek () const {return current;}  int peekPrev () const {return prev;}  // get next char  virtual void get ();  int getLine () const {return line;}  int getColumn () const {return col;}  string getFilename () const {return filename;}  int getPoint () const {return 0;}	// current input point  void setPoint (int point) {};  void resetPoint () {};		// flush backtrack buffer  unsigned getState () const;  static int inState (unsigned state, unsigned flag)  {return state & flag;}protected:  int doPeek () const {return str.eof () ? EOFChar : str.peek ();}  istream &str;  int prev, current;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -