📄 compilecode.h
字号:
// CompileCode.h: interface for the CCompileCode class.
//
//////////////////////////////////////////////////////////////////////
/*
* Generated by MyEclipse Struts
*
* Written by Yang Huaisheng
* Homepage: http://codefan.spaces.live.com
* version 0.01
* create at 2006-04-30
*
* Distribute freely, except: don't remove my name from the source or
* documentation (don't take credit for my work), mark your changes (don't
* get me blamed for your possible bugs), don't alter or remove this
* notice.
* No warrantee of any kind, express or implied, is included with this
* software; use at your own risk, responsibility for damages (if any) to
* anyone resulting from the use of this software rests entirely with the
* user.
*
* Send bug reports, bug fixes, enhancements, requests, flames, etc. to
* codefan@hotmial.com
*
*/
#if !defined(AFX_COMPILECODE_H__8F03A546_4220_4BEE_B6BB_DCEB50A0BD45__INCLUDED_)
#define AFX_COMPILECODE_H__8F03A546_4220_4BEE_B6BB_DCEB50A0BD45__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "..\Interface\ConstDef.h"
#include "FormulaModula.h"
//#include "CommonDataDef.h"
class CSZGetWord
{
public:
CSZGetWord();
virtual ~CSZGetWord();
private:
LPCTSTR m_szSource;
int m_nSourceLen;
int m_nCmpPos;
int m_nCurLine;
int m_nCurLineBeginPos;
private:
inline void NewLine();
void TrimSpace();
void TrimComment();
public:
BOOL m_bAcceptOpt;
inline int GetCurPos();//{return m_nCmpPos;}
inline int GetCurLine();
inline int GetCurPosInLine();
inline bool IsEnd();// {return m_nCmpPos>=m_nSourceLen;}
// inline void SetPreword(LPCTSTR preWord);//{m_preWord = preWord; m_bIsBack = true;}
void Reset();// {m_nCmpPos=0;}
void SetSource(LPCTSTR szSou, int nL=-1);
CString GetAWord();
};
struct SJMPChain{
int SEN_TYPE;// RES_WHILE RES_FOR RES_SWITCH
int nBegChain; // CONTINUE * *
int nEndChain; // BREAK * * *
};
typedef SJMPChain * PJMPCHAIN;
class CChainStack
{
public:
CChainStack();
virtual ~CChainStack();
private:
int m_nDept;
CArray<SJMPChain,SJMPChain&> m_Stack;
public:
int GetDept();
void Push(SJMPChain & SC);
SJMPChain Pop();
PJMPCHAIN GetTop();
PJMPCHAIN GetTopLoopChain();
void Clear();
BOOL IsEmpty();
};
class CCompileCode
{
public:
CCompileCode();
virtual ~CCompileCode();
private:
CString m_sCurWord;
WORD_TYPE m_CurWT;
int m_nCurISN;
BOOL m_bIsBack;
CSZGetWord m_SourceCode;
PFORMUALMODULE m_pFormulaModula;
CChainStack m_JMPChain;
private:
CStringList m_slErrorMsgs;
private:
void Reset();
void RaiseWarning(LPCTSTR sMsg);
void RaiseError(LPCTSTR sMsg);
void WordMissing(LPCTSTR sWord);
void WordRedefined(LPCTSTR sWord);
int Advance();
void BackOff();
int IsSeparator(LPCTSTR sWord);
int IsOperator (LPCTSTR sWord);
int IsEvaluate (LPCTSTR sWord);
int IsResKey(LPCTSTR sWord);
int IsSysFunc(LPCTSTR sWord);
int IsModule(LPCTSTR sWord);
int GenFormula(int nOpt,int nResult,int nPrm = 0,int nPrm2=0);
void FillJmpChain(int nChain, int nJMPP = -1);
BOOL CmpSentence();
BOOL CmpSingleSentence();//int nSignISN);
BOOL CmpMultiSentence();
void CmpIfElseSen();
void CmpForSen();
void CmpWhileSen();
void CmpSignDef();
void CmpFuncDef();
void CmpSwitchSen();
void CmpReturn();
int CmpPushParameter();
int CmpCallSysFunc();
int CmpCallModule(int nRet=ISN_EMPTY);
int CmpFormula();
int CmpItem();
public:
void SetFormulaModule(PFORMUALMODULE pFM);
int Compile();
void ClearError();
int GetErrorSum();
CString GetErrorDesc(int nInd);
};
#endif // !defined(AFX_COMPILECODE_H__8F03A546_4220_4BEE_B6BB_DCEB50A0BD45__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -