?? parser.h
字號:
/**************************************************************************************************
* parser.h
*
* 2008-04-20 12:13
* 周鑫(zhouxin63766@yahoo.com.cn)
*
* 語法分析。
*************************************************************************************************/
#ifndef PARSER_H
#define PARSER_H
#include <cstdarg>
#include <QStringList>
#include "glossary.h"
#include "shared.h"
typedef double (*FuncPtr)(double);
struct ExprNode
{
enum TokenType opCode;
union
{
struct
{
ExprNode *Left;
ExprNode *Right;
}CaseOperator;
struct
{
ExprNode *Child;
FuncPtr MathFuncPtr;
}CaseFunc;
double CaseConst;
double *CaseParmPtr;
}Content;
};
// Forward declaration
class QString;
class Parser
{
public:
Parser();
~Parser();
bool build( const QString &fileName );
QStringList errorList()
{
return _errorList;
}
private:
void fetchToken();
void matchToken( enum TokenType AToken );
void syntaxError( int errorCase );
void printSyntaxTree( struct ExprNode *root, int indent = 1 );
void program();
void statement();
void originStatement();
void rotStatement();
void scaleStatement();
void forStatement();
struct ExprNode *expression();
struct ExprNode *term();
struct ExprNode *factor();
struct ExprNode *component();
struct ExprNode *atom();
struct ExprNode *makeExprNode( enum TokenType opcode, ... );
Token token;
double parameter; // 參數(shù)T的存儲空間
double originX, originY; // 橫、縱平移距離
double scaleX, scaleY; //橫、縱比例因子
double rotAngle; //旋轉(zhuǎn)角度
QStringList _errorList;
Glossary *glossary;
bool noError;
};
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -