lexer.h

来自「compiler principle how to ananilyze」· C头文件 代码 · 共 41 行

H
41
字号
// Lexer.h: interface for the Lexer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_LEXER_H__B4398D77_71EF_4B94_A279_08D548DD6E8A__INCLUDED_)
#define AFX_LEXER_H__B4398D77_71EF_4B94_A279_08D548DD6E8A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Token.h"

#include <vector>
#include <fstream>
using namespace std;

class Lexer
{
private:
	enum {BSIZE = 128 };
	char lexbuf[BSIZE];  // temporary buffer to keep a string under being recognised, 
	char* lexbuf_p;
	const char* lexbuf_end;

	int line_no;          // the current line no when doing lexcial analysing

	ifstream* inFile;	 //input grammar file

	Token getVN_epsilon(char first);
	Token getVT();
public:
	Lexer();
	void initialize(ifstream* ainFile);
	Token getNextToken();
	int getLineNo() const;
};

#endif // !defined(AFX_LEXER_H__B4398D77_71EF_4B94_A279_08D548DD6E8A__INCLUDED_)

⌨️ 快捷键说明

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