?? funcheck.h
字號:
#ifndef MY_FUNCHECK_H_
#define MY_FUNCHECK_H_
#include "parser.h"
/*----------------------------------------------*/
/* FunArgsCheck */
/*----------------------------------------------*/
/* 這個思想主要來自于符號表,這里建立了一個類似*/
/* 符號表的函數聲明表,記錄參數,函數名,等等的 */
/* 信息,用來在類型檢查的時候,檢測函數調用的正 */
/* 確性。 */
/*----------------------------------------------*/
struct ParamListRec {
ParamListRec():isArr(false), next(NULL) {}
ParamListRec(tokenType t, bool arr) : type(t), isArr(arr), next(NULL) {}
~ParamListRec() { if (next) delete next; }
// ...
tokenType type;
bool isArr;
ParamListRec *next;
};
struct FunDecListRec {
FunDecListRec():count(0), lineno(0), next(NULL) {}
FunDecListRec(const string &s, const tokenType t) :name(s), type(t),
count(0), lineno(0), params(NULL), next(NULL)
{}
~FunDecListRec() { if (next) delete next; if (params) delete params; }
int count; // record the params count
int lineno; // record the function defined line;
string name;
tokenType type;
ParamListRec *params;
FunDecListRec *next;
};
// ...
/**: class FunArgsCheck;
&
* author: lonelyforest
* data: 2006.04.08
*/
class FunArgsCheck {
public:
FunArgsCheck(): first(NULL), last(NULL)
{}
~FunArgsCheck() { if (first) delete first; } // don't delete last
void initial();
void insert(TreeNode *pNode);
int check(TreeNode *pNode, string &args, int &line); // check for function call
private:
FunDecListRec *first, *last;
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -