LuaFunctionRegisterSpreadsheet/GhidraParser/FunctionInfo.hpp

49 lines
1021 B
C++
Raw Permalink Normal View History

#pragma once
#include "Utility.hpp"
#include <map>
#include <optional>
#include <regex>
#include <string>
#include <unordered_map>
#include <vector>
const int MAX_ITER = 256;
struct LoopInfo
{
int idx;
int iter;
};
typedef unsigned int uint;
typedef std::unordered_map<std::string, LoopInfo> lp_track;
typedef std::unordered_map<std::string, int> locals;
typedef std::map<int, std::vector<std::string>> varmap;
struct FunctionInfo
{
std::smatch match;
uint addr = 0;
std::string nm = "";
std::string usg = "";
varmap in{};
int in_cnt = 0;
varmap out{};
int out_cnt = 0;
std::vector<std::string> prs_msg;
bool prs_vld = false;
void chk_vld();
void cln_varmap(bool prc_in);
bool nil_in_varmap(bool prc_in) const;
bool prc_varmap_rgx(bool prc_in, const std::string& ln_in, std::regex& rgx, locals& lcls);
std::string str() const;
std::string str_varmap(bool prc_in) const;
FunctionInfo();
FunctionInfo(std::vector<std::string> src);
};
std::optional<int> eval(std::string& infix, locals& lcls);