📄 codeobject.cpp
字号:
#include "StdAfx.h"
#include "codeobject.h"
char * Utility::LastError = NULL;
const char * Utility::ObjectTypeName(ObjectType type)
{
#define OT_NAME(Type) case Type: return #Type
switch(type)
{
OT_NAME(Null);
OT_NAME(EndOfFile);
OT_NAME(Input);
OT_NAME(Integer);
OT_NAME(Expression);
OT_NAME(Value);
OT_NAME(OpenParenthesis);
OT_NAME(CloseParenthesis);
OT_NAME(PlusSign);
OT_NAME(Operator);
default:
return "?Unknown";
}
#undef OT_NAME
}
void CodeObject::Dump(FILE * stream, bool sub, int nIndent)
{
for(int i = 0; i < nIndent; i++)
fputc(' ', stream);
if (Token)
fprintf(stream, "[%s - Line #%d (Token = \"%s\")]\n", ObjectTypeName(Type), Line, Token);
else
fprintf(stream, "[%s - Line #%d]\n", ObjectTypeName(Type), Line);
if (sub)
for(CppList<CodeObject*>::iterator _Iter = Descendants->begin(); _Iter != Descendants->end(); _Iter++)
(*_Iter)->Dump(stream, true, nIndent+1);
}
CodeObject::CodeObject(void)
{
Line = 0;
Token = NULL;
Type = Null;
Descendants = new CppList<CodeObject*>;
}
CodeObject::~CodeObject(void)
{
delete Descendants;
if (Token)
free(Token);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -