forked from metin2/server
1
0
Fork 0
server/libpoly/include/Poly.h

57 lines
1.1 KiB
C++

#ifndef __POLY_POLY_H__
#define __POLY_POLY_H__
#include "SymTable.h"
#include <string>
#include <vector>
#include <list>
class CPoly
{
public:
CPoly();
virtual ~CPoly();
int Analyze(const char * pszStr = NULL);
double Eval();
void SetStr(const std::string & str);
int SetVar(const std::string & strName, double dVar);
double GetVar(const std::string & strName);
void Clear();
protected:
int my_irandom(double start, double end);
double my_frandom(double start, double end);
void init();
int insert(const std::string & s, int tok);
int find(const std::string & s);
void emit(int t,int tval);
void match(int t);
void expo();
void factor();
void term();
int lexan();
void error();
void expr();
int iToken;
double iNumToken;
int iLookAhead;
int iErrorPos;
bool ErrorOccur;
unsigned int uiLookPos;
// NOTE: list is slight faster than vector, why?!
std::vector<int> tokenBase;
std::vector<double> numBase;
std::vector<CSymTable *> lSymbol;
std::vector<int> SymbolIndex;
int STSize;
std::string strData;
};
#endif