mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-27 14:18:06 +03:00
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
|
#ifndef _INCLUDE_AMXCOMPILER_H
|
||||||
#define _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
|
typedef enum
|
||||||
{
|
{
|
||||||
Token_None,
|
Token_None,
|
||||||
@ -60,6 +77,7 @@ public:
|
|||||||
bool Compile();
|
bool Compile();
|
||||||
int CurLine() { return curLine; }
|
int CurLine() { return curLine; }
|
||||||
ErrorMngr *ErrorHandler() { return CError; }
|
ErrorMngr *ErrorHandler() { return CError; }
|
||||||
|
void PrintCodeList();
|
||||||
public:
|
public:
|
||||||
int FindArguments(std::string &text, std::vector<std::string*> &List, int &end, bool simple = false);
|
int FindArguments(std::string &text, std::vector<std::string*> &List, int &end, bool simple = false);
|
||||||
private:
|
private:
|
||||||
|
@ -57,6 +57,8 @@ void DataMngr::Add(std::string &s, CExpr &expr, bool db)
|
|||||||
((p->e.GetType() == Val_Number) ?
|
((p->e.GetType() == Val_Number) ?
|
||||||
cellsize : p->e.Size() * cellsize);
|
cellsize : p->e.Size() * cellsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List.push_back(D);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataMngr::Datum *DataMngr::FindData(std::string &sym)
|
DataMngr::Datum *DataMngr::FindData(std::string &sym)
|
||||||
|
@ -46,6 +46,7 @@ private:
|
|||||||
std::vector<DataMngr::Datum *> List;
|
std::vector<DataMngr::Datum *> List;
|
||||||
int lastOffset;
|
int lastOffset;
|
||||||
int cellsize;
|
int cellsize;
|
||||||
|
public:
|
||||||
static const int nof = -1;
|
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_Hex_Start) = "Hexadecimal notation is 0xN, 0 missing";
|
||||||
List.at(Warning_Null_Expression) = "Bad expression will evaluate to 0";
|
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_Terminate) = "String not terminated properly";
|
||||||
List.at(Err_String_Extra) = "Unexpected characters after string end (character '%c')";
|
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_Invalid_Symbol) = "Invalid symbol";
|
||||||
List.at(Err_Opcode) = "Invalid or unrecognized opcode";
|
List.at(Err_Opcode) = "Invalid or unrecognized opcode";
|
||||||
List.at(Err_Unmatched_Token) = "Unmatched token '%c'";
|
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_FileNone) = "No file specified";
|
||||||
List.at(Err_FileOpen) = "Could not open file \"%s\"";
|
List.at(Err_FileOpen) = "Could not open file \"%s\"";
|
||||||
|
@ -40,6 +40,7 @@ typedef enum
|
|||||||
warnings_start,
|
warnings_start,
|
||||||
Warning_Hex_Start,
|
Warning_Hex_Start,
|
||||||
Warning_Null_Expression,
|
Warning_Null_Expression,
|
||||||
|
Warning_Param_Count,
|
||||||
warnings_end,
|
warnings_end,
|
||||||
|
|
||||||
errors_start,
|
errors_start,
|
||||||
@ -55,6 +56,7 @@ typedef enum
|
|||||||
Err_Invalid_Symbol,
|
Err_Invalid_Symbol,
|
||||||
Err_Opcode,
|
Err_Opcode,
|
||||||
Err_Unmatched_Token,
|
Err_Unmatched_Token,
|
||||||
|
Err_Param_Count,
|
||||||
errors_end,
|
errors_end,
|
||||||
|
|
||||||
fatals_start,
|
fatals_start,
|
||||||
|
@ -35,6 +35,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
Program.Load(filename);
|
Program.Load(filename);
|
||||||
Program.Parse();
|
Program.Parse();
|
||||||
|
Program.PrintCodeList();
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -216,5 +216,6 @@ typedef enum {
|
|||||||
|
|
||||||
void get_options(int argc, char **argv);
|
void get_options(int argc, char **argv);
|
||||||
void InitOpcodes();
|
void InitOpcodes();
|
||||||
|
void DestroyArgList(std::vector<std::string *> &List);
|
||||||
|
|
||||||
#endif //_INCLUDE_AMXASM_H
|
#endif //_INCLUDE_AMXASM_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user