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

📄 codeobject.h

📁 用VC实现的词法分析器
💻 H
字号:
#pragma once

#include <list>
using std::list;

enum ObjectType
{
    Null = 0,
	EndOfFile,
	NewLine,
	Input,
	Integer,
	Value,
	Expression,
	PlusSign,
	Operator,
	OpenParenthesis,
	CloseParenthesis,
};

struct IDump
{
public:
	virtual void Dump(FILE * stream, bool sub, int nIndent = 0) = 0;
};

namespace Utility
{
	template <typename Type>
	class MallocList : public list<Type>
	{
	public:

		~MallocList()
		{
			std::list<Type>::iterator _Iter;
			for(_Iter = begin(); _Iter != end(); ++_Iter)
				free(*_Iter);
		}
	};

	template <typename Type>
	class CppList : public list<Type>
	{
	public:

		~CppList()
		{
			std::list<Type>::iterator _Iter;
			for(_Iter = begin(); _Iter != end(); ++_Iter)
				delete (*_Iter);
		}
	};


	const char * ObjectTypeName(ObjectType);

	extern char * LastError;
};

using namespace Utility;


class CodeObject : public IDump
{
public:

	virtual void Dump(FILE * stream, bool sub, int nIndent = 0);

	CodeObject(void);
	~CodeObject(void);

	unsigned Line;
	char * Token;
	ObjectType Type;
	CppList<CodeObject*> * Descendants;
};

⌨️ 快捷键说明

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