symboltable.h
来自「compiler principle how to ananilyze」· C头文件 代码 · 共 49 行
H
49 行
// SymbolTable.h: interface for the SymbolTable class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SYMBOLTABLE_H__8E4737A8_F7F6_4D25_8B14_86FCCB9D17BA__INCLUDED_)
#define AFX_SYMBOLTABLE_H__8E4737A8_F7F6_4D25_8B14_86FCCB9D17BA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "SymbolEntry.h"
#include "Token.h"
#include <vector>
#include <string>
using namespace std;
class SymbolTable {
private:
typedef vector<SymbolEntry> VectorTable;
VectorTable table;
int findByKind(const string& alexeme, int token_kind) const;
public:
SymbolTable();
int find(const string& alexeme) const;
int find(const string& alexeme, int token_type) const;
int findInKeywords(const string& alexeme) const;
int findInVs(const string& alexeme) const;
int append(const SymbolEntry& se);
int insert(const string& alexeme, int token_type);
Token getToken(int index) const;
void setTokenType(int index, int token_type); //change VN to GN
const string& getLexeme(int index) const;
const SymbolEntry& operator[](int index) const;
SymbolEntry& operator[](int index);
string toStr() const;
};
#endif // !defined(AFX_SYMBOLTABLE_H__8E4737A8_F7F6_4D25_8B14_86FCCB9D17BA__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?