📄 token.h
字号:
/******************************************************************************
文件名 :Token.h
版本号 : 1.0
作者 : Amos Peng
生成日期 :2008-07-08
最近修改 :
功能描述 :运算符
函数列表 :
*******************************************************************************/
#ifndef _TOKEN_H_
#define _TOKEN_H_
// Includes
#include <vector>
#include <string>
#include <new>
#include <memory>
#include "Nodes.h"
#include "Except.h"
#include "FunctionList.h"
#include "Expression.h"
// Part of expreval namespace
namespace ExprEval
{
// Forward declarations
class CExpression;
class CNode;
// Token class
//--------------------------------------------------------------------------
class CToken
{
public:
// Token type
enum TokenType
{
TypeUnknown = 0,
// Basic types
TypeOpenParenthesis, // '('
TypeCloseParenthesis, // ')'
TypeEqual, // '='
TypePlus, // '+'
TypeHyphen, // '-'
TypeAsterisk, // '*'
TypeForwardSlash, // '/'
TypeHat, // '^'
TypeAmpersand, // '&'
TypeComma, // ','
TypeSemicolon, // ';'
TypeIdentifier, // name
TypeValue, // 0.2, .6, 2.1
};
// Constructors
CToken(TokenType type, ::std::string::size_type start, ::std::string::size_type end);
CToken(const ::std::string &ident, ::std::string::size_type start, ::std::string::size_type end); // May throw if can not copy string
CToken(double value, ::std::string::size_type start, ::std::string::size_type end);
// Information
TokenType GetType() const;
const ::std::string &GetIdentifier() const;
double GetValue() const;
::std::string::size_type GetStart() const;
::std::string::size_type GetEnd() const;
private:
TokenType m_type; // Type of token
::std::string m_ident; // If type is Identifier
double m_value; // If type is Value
::std::string::size_type m_start, m_end;
};
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -