token.cpp

来自「an easy compiler to compile C」· C++ 代码 · 共 30 行

CPP
30
字号
// Token.cpp: implementation of the Token class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Token.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

string Token::toStr() const {
	string a ("(");
	a += char(type);
	a += " , ";
	a += char(value);
	a += ")";
	return a;
}

Token::Token(): type(Token::EMPTY), value(Token::NONE) {}

Token::Token(int atype, int avalue):
  type(atype), value(avalue)
{}

bool Token::operator ==(const Token& tk) const {
	return type == tk.type && value == tk.value;
}

⌨️ 快捷键说明

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