📄 elexscannerbase.h
字号:
/* $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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -