Fixed many parsing and logic bugs.
Finished more opcodes.
This commit is contained in:
parent
a1e955370b
commit
e61fa39515
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,23 @@
|
||||
#ifndef _INCLUDE_AMXCOMPILER_H
|
||||
#define _INCLUDE_AMXCOMPILER_H
|
||||
|
||||
#define CHK_PARAMS(d) \
|
||||
if (paramList.size() > d) \
|
||||
{ \
|
||||
CError->ErrorMsg(Warning_Param_Count, paramList.size(), d); \
|
||||
} else if (paramList.size() < d) { \
|
||||
CError->ErrorMsg(Err_Param_Count, paramList.size(), d); \
|
||||
delete ASM; \
|
||||
ASM = 0; \
|
||||
}
|
||||
|
||||
#define PUSH_PARAM(n,sym) \
|
||||
if (paramList.size() >= n) \
|
||||
{ \
|
||||
ASM->params.push_back(Eval(*(paramList[n-1]), sym)); \
|
||||
lastCip++; \
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Token_None,
|
||||
@ -60,6 +77,7 @@ public:
|
||||
bool Compile();
|
||||
int CurLine() { return curLine; }
|
||||
ErrorMngr *ErrorHandler() { return CError; }
|
||||
void PrintCodeList();
|
||||
public:
|
||||
int FindArguments(std::string &text, std::vector<std::string*> &List, int &end, bool simple = false);
|
||||
private:
|
||||
|
@ -57,6 +57,8 @@ void DataMngr::Add(std::string &s, CExpr &expr, bool db)
|
||||
((p->e.GetType() == Val_Number) ?
|
||||
cellsize : p->e.Size() * cellsize);
|
||||
}
|
||||
|
||||
List.push_back(D);
|
||||
}
|
||||
|
||||
DataMngr::Datum *DataMngr::FindData(std::string &sym)
|
||||
|
@ -46,6 +46,7 @@ private:
|
||||
std::vector<DataMngr::Datum *> List;
|
||||
int lastOffset;
|
||||
int cellsize;
|
||||
public:
|
||||
static const int nof = -1;
|
||||
};
|
||||
|
||||
|
@ -57,6 +57,7 @@ void ErrorMngr::DefineErrors()
|
||||
|
||||
List.at(Warning_Hex_Start) = "Hexadecimal notation is 0xN, 0 missing";
|
||||
List.at(Warning_Null_Expression) = "Bad expression will evaluate to 0";
|
||||
List.at(Warning_Param_Count) = "Expected %d parameters, found %d";
|
||||
|
||||
List.at(Err_String_Terminate) = "String not terminated properly";
|
||||
List.at(Err_String_Extra) = "Unexpected characters after string end (character '%c')";
|
||||
@ -69,6 +70,7 @@ void ErrorMngr::DefineErrors()
|
||||
List.at(Err_Invalid_Symbol) = "Invalid symbol";
|
||||
List.at(Err_Opcode) = "Invalid or unrecognized opcode";
|
||||
List.at(Err_Unmatched_Token) = "Unmatched token '%c'";
|
||||
List.at(Err_Param_Count) = "Expected %d parameters, found %d";
|
||||
|
||||
List.at(Err_FileNone) = "No file specified";
|
||||
List.at(Err_FileOpen) = "Could not open file \"%s\"";
|
||||
|
@ -40,6 +40,7 @@ typedef enum
|
||||
warnings_start,
|
||||
Warning_Hex_Start,
|
||||
Warning_Null_Expression,
|
||||
Warning_Param_Count,
|
||||
warnings_end,
|
||||
|
||||
errors_start,
|
||||
@ -55,6 +56,7 @@ typedef enum
|
||||
Err_Invalid_Symbol,
|
||||
Err_Opcode,
|
||||
Err_Unmatched_Token,
|
||||
Err_Param_Count,
|
||||
errors_end,
|
||||
|
||||
fatals_start,
|
||||
|
@ -35,6 +35,7 @@ int main(int argc, char **argv)
|
||||
|
||||
Program.Load(filename);
|
||||
Program.Parse();
|
||||
Program.PrintCodeList();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -216,5 +216,6 @@ typedef enum {
|
||||
|
||||
void get_options(int argc, char **argv);
|
||||
void InitOpcodes();
|
||||
void DestroyArgList(std::vector<std::string *> &List);
|
||||
|
||||
#endif //_INCLUDE_AMXASM_H
|
||||
|
Loading…
Reference in New Issue
Block a user