?? mlr1.h
字號:
#if !defined(AFX_MLR1_H__E7626B26_4BA9_4910_849A_151001216F5E__INCLUDED_)
#define AFX_MLR1_H__E7626B26_4BA9_4910_849A_151001216F5E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
//-128 空輸入
//-127 結束符$
//-126..-1 非終結符編號
//0 字符串結束標志
//1-127 終結符的ASCII碼
#ifndef LENGTH
#define ID_LENGTH 20
#define LINE_LENGTH 128
#define MAX_IDENT 126
#define MAP_SIZE 16
#define LR_NULL -128
#define LR_EOF -127
#define LR_EOS 0
#endif
class MLR1{
public:
CString GetFirst(int i);
CString GetFollow(int i);
public:
MLR1();
virtual ~MLR1();
void ReSet(FILE*);
const CStringArray& GetIdentList();
int GetExpressNum();
int GetIdentNum();
protected:
bool Lex1();
bool Lex2();
int Lex2_1(char*&,bool isUse=false);
bool Lex3();
bool FirstSet1(const char*);
bool FirstSet2(const char);
bool FirstSet3(const char*,char*);
bool FirstSet4(const char,char*);
CString FirstSet5(const char*,bool has_null=false);
void FirstSet6();
CString FollowSet1(const char*,bool has_eof=false);
bool FollowSet2(const char,char*);
void FollowSet3();
private:
CStringArray list_Ident;
CStringArray list_Express;
struct s_first{
char Fi[MAP_SIZE];
char Fo[MAP_SIZE];
char flag;}
m_first[MAX_IDENT];
//b6:正在計算Fi0x40
//b5-b3:正在計算Fo0x20,Fo以求解0x10,包含LR_EOF0x08
//b2-b0:Fi已求解0x04,推出LR_NULL0x02,b1有效0x01
char token[LINE_LENGTH+1];
int token_len;
char bit_map[MAP_SIZE];
FILE* p_file;
};
inline const CStringArray& MLR1::GetIdentList(){
return list_Ident;}
inline int MLR1::GetExpressNum(){
return list_Express.GetSize();}
inline int MLR1::GetIdentNum(){
return list_Ident.GetSize();}
#endif
//First集以空推導檢測為前提
//Follow集以First集為前提
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -