codeobject.h
来自「用VC实现的词法分析器」· C头文件 代码 · 共 78 行
H
78 行
#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 + =
减小字号Ctrl + -
显示快捷键?