elexscannerbase.h

来自「用于词法分析的词法分析器」· C头文件 代码 · 共 55 行

H
55
字号
/*  $Id: ElexScannerBase.h,v 1.7 1997/03/19 12:16:33 matt Exp $  Elex scanner base class.  (c) Matt Phillips 1996.  */#ifndef _ELEX_SCAN_BASE_H#define _ELEX_SCAN_BASE_H#include <std/string.h>#include "ElexScannerData.h"class ElexScannerBase{public:  // Predefined symbol values.  enum {SymNULL = -1, SymEOF = -2, SymERROR = -3};  ElexScannerBase (ElexScannerData &d) : data (d), symbol (SymNULL) {}  virtual ~ElexScannerBase () {}  // Read next symbol from input.  No effect if at EOF.  virtual int getNext () = 0;  // Return the current symbol.  int getSymbol () const {return symbol;}  // Return the text matched for current symbol.  virtual const string &getText () const = 0;  virtual string &getText () = 0;  // True if scanner is at end of input.  int eof () const {return getSymbol () == SymEOF;}  // Generate an error or warning message.  virtual void error (const string &message) = 0;  virtual void warning (const string &message) = 0;  // Returns true and does a getNext () if current symbol == <sym>,  // otherwise does nothing and returns false.  int have (int sym);protected:  int symbol;  ElexScannerData &data;};#endif

⌨️ 快捷键说明

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