Rewrote core algebraic parser

Added trivial float support
Added local labels and vastly improved label support
Fixed some crash bugs
This commit is contained in:
David Anderson
2004-08-11 08:14:54 +00:00
parent 74d278d1c6
commit 7acc70ee62
15 changed files with 444 additions and 185 deletions

View File

@ -40,30 +40,12 @@
lastCip+=cellsize; \
}
typedef enum
{
Token_None,
Token_Or,
Token_Xor,
Token_And,
Token_Shr,
Token_Shl,
Token_Mod,
Token_Div,
Token_Mul,
Token_Sub,
Token_Add,
Token_Not,
/* End */
Tokens_Total,
} OpToken;
class rpn
{
public:
//TODO: use linked lists, but not std::list
std::vector<char> ops;
std::vector<int> vals;
std::vector<CExpr> vals;
};
class Compiler
@ -91,9 +73,10 @@ public: //private
void Init();
void InitOpcodes();
int Eval(std::string &str, SymbolType sym = Sym_None);
int EvalRpn(rpn *r, SymbolType sym);
CExpr EvalRpn(rpn *r, SymbolType sym);
OpToken OperToken(char c);
char OperChar(OpToken c);
bool IsSymbol(std::string &str);
private:
std::vector<Asm *> CodeList;
std::map<std::string,int> OpCodes;
@ -115,4 +98,4 @@ private:
Asm *curAsm;
};
#endif //_INCLUDE_AMXCOMPILER_H
#endif //_INCLUDE_AMXCOMPILER_H