feat: 实现一些方法

This commit is contained in:
msojocs 2023-08-18 21:48:55 +08:00
parent 8fd8fd8b7e
commit 7e477026f1
5 changed files with 119 additions and 29 deletions

View File

@ -158,8 +158,6 @@ namespace WXSS
std::vector<std::string> offset_4_vecStr;
// ~Rule();
};
class LexicalChecker
{
private:
@ -179,8 +177,6 @@ namespace WXSS
static LexicalChecker* GetInstance(bool);
};
class Parser
{
private:

View File

@ -4,6 +4,72 @@ namespace WXSS
{
namespace CSSTreeLib
{
int off_519BB4(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
int ret = 0;
for (int i = 0; i < a1->offset_4_vecPtr.size(); i++)
{
auto cur = a1->offset_4_vecPtr[i];
ret = cur->offset_0(cur, a2);
}
a2->offset_116 = ret;
return ret;
}
int off_519B6C(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519B9C(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519AA0(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519A58(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
/**
* WXSS::CSSTreeLib::ChildRule::MarkGood
*/
int off_519B84(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519B40(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519BCC(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519A88(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519AB8(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519A70(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519AE8(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
int off_519AD0(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
{
throw "not implement";
}
LexicalChecker::LexicalChecker(/* args */)
{
}
@ -23,17 +89,27 @@ namespace WXSS
}
void LexicalChecker::Init(bool a3)
{
/**
* 00519BB4 - WXSS::CSSTreeLib::RuleChain::MarkGood
*
*/
// Init - 0
if (!this->offset_0)
{
std::shared_ptr<WXSS::CSSTreeLib::Rule> v3(new WXSS::CSSTreeLib::Rule());
v3->offset_0 = off_519B6C;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v4(new WXSS::CSSTreeLib::Rule());
v4->offset_0 = off_519B9C;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v5(new WXSS::CSSTreeLib::Rule());
v5->offset_0 = off_519BB4;
// Init - 5
this->offset_4 = v5;
auto v44 = &this->offset_4->offset_4_vecPtr;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v57(new WXSS::CSSTreeLib::Rule());
v57->offset_0 = off_519B84;
v44->push_back(v57);
v44->push_back(v3);
std::shared_ptr<WXSS::CSSTreeLib::Rule> v59(new WXSS::CSSTreeLib::Rule());
@ -42,27 +118,28 @@ namespace WXSS
v61->offset_4_vecPtr.push_back(v59);
if (a3) {
std::shared_ptr<WXSS::CSSTreeLib::Rule> v92(new WXSS::CSSTreeLib::Rule());
// off_519AA0
v92->offset_0 = off_519AA0;
v61->offset_4_vecPtr.push_back(v92);
}
std::shared_ptr<WXSS::CSSTreeLib::Rule> v63(new WXSS::CSSTreeLib::Rule());
// off_519A58
v63->offset_0 = off_519A58;
v61->offset_4_vecPtr.push_back(v63);
v57->offset_4_vecPair.emplace_back("RULE", v61);
// Init - 15
std::shared_ptr<WXSS::CSSTreeLib::Rule> v65(new WXSS::CSSTreeLib::Rule());
// off_519B84
v65->offset_0 = off_519B84;
v57->offset_4_vecPair.emplace_back("MULTIRULE", v65);
v65->offset_4_vecPair.emplace_back("RULES", this->offset_4);
// Init - 20
std::shared_ptr<WXSS::CSSTreeLib::Rule> v67(new WXSS::CSSTreeLib::Rule());
// off_519BB4
v67->offset_0 = off_519BB4;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v69(new WXSS::CSSTreeLib::Rule());
// off_519B84
v69->offset_0 = off_519B84;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v71(new WXSS::CSSTreeLib::Rule());
// off_519AD0
v71->offset_0 = off_519AD0;
v67->offset_4_vecPtr.push_back(v69);
v67->offset_4_vecPtr.push_back(v71);
@ -70,69 +147,70 @@ namespace WXSS
v59->offset_4_vecPair.emplace_back("SELECTORS", v67);
// Init - 25
std::shared_ptr<WXSS::CSSTreeLib::Rule> v77(new WXSS::CSSTreeLib::Rule());
// off_519B84
v77->offset_0 = off_519B84;
v69->offset_4_vecPair.emplace_back("SELECTOR", v77);
std::shared_ptr<WXSS::CSSTreeLib::Rule> v79(new WXSS::CSSTreeLib::Rule());
// off_519B84
v79->offset_0 = off_519B84;
v77->offset_4_vecPair.emplace_back("$NAME", v79);
// Init - 30
std::shared_ptr<WXSS::CSSTreeLib::Rule> v81(new WXSS::CSSTreeLib::Rule());
// off_519B40
v81->offset_0 = off_519B40;
v69->offset_4_vecPair.emplace_back("F_SELECTOR", v81);
std::shared_ptr<WXSS::CSSTreeLib::Rule> v83(new WXSS::CSSTreeLib::Rule());
// off_519B84
v83->offset_0 = off_519B84;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v85(new WXSS::CSSTreeLib::Rule());
// off_519BCC
v85->offset_0 = off_519BCC;
// v85->
v81->offset_4_vecPtr.push_back(v83);
v81->offset_4_vecPtr.push_back(v85);
// Init - 35
std::shared_ptr<WXSS::CSSTreeLib::Rule> v87(new WXSS::CSSTreeLib::Rule());
// off_519A88
v87->offset_0 = off_519A88;
v87->offset_4_vecStr.push_back("root");
v83->offset_4_vecPair.emplace_back("$NAME", v87);
v77->offset_4_vecPair.emplace_back("SELECTOR", v77);
// Init - 40
std::shared_ptr<WXSS::CSSTreeLib::Rule> v73(new WXSS::CSSTreeLib::Rule());
// off_519BB4
v73->offset_0 = off_519BB4;
v59->offset_4_vecPair.emplace_back("ATTRS", v73);
std::shared_ptr<WXSS::CSSTreeLib::Rule> v75(new WXSS::CSSTreeLib::Rule());
// off_519B84
v75->offset_0 = off_519B84;
v73->offset_4_vecPtr.push_back(v75);
v73->offset_4_vecPtr.push_back(v3);
std::shared_ptr<WXSS::CSSTreeLib::Rule> v24(new WXSS::CSSTreeLib::Rule());
// off_519BB4
v24->offset_0 = off_519BB4;
v75->offset_4_vecPair.emplace_back("ATTR", v24);
// Init - 45
std::shared_ptr<WXSS::CSSTreeLib::Rule> v25(new WXSS::CSSTreeLib::Rule());
// off_519B40
v25->offset_0 = off_519B40;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v26(new WXSS::CSSTreeLib::Rule());
// off_519B84
v26->offset_0 = off_519B84;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v27(new WXSS::CSSTreeLib::Rule());
// off_519AB8
v27->offset_0 = off_519AB8;
v26->offset_4_vecPair.emplace_back("$ESV", v27);
v25->offset_4_vecPtr.push_back(v26);
if (a3)
{
std::shared_ptr<WXSS::CSSTreeLib::Rule> v28(new WXSS::CSSTreeLib::Rule());
// off_519A70
v28->offset_0 = off_519A70;
v25->offset_4_vecPtr.push_back(v28);
}
v24->offset_4_vecPtr.push_back(v25);
// Init - 50
std::shared_ptr<WXSS::CSSTreeLib::Rule> v29(new WXSS::CSSTreeLib::Rule());
// off_519B84
v29->offset_0 = off_519B84;
std::shared_ptr<WXSS::CSSTreeLib::Rule> v30(new WXSS::CSSTreeLib::Rule());
// off_519AE8
v30->offset_0 = off_519AE8;
v29->offset_4_vecPair.emplace_back("$ESV", v29);
v24->offset_4_vecPtr.push_back(v29);
@ -146,7 +224,7 @@ namespace WXSS
{
if (this->offset_0)
{
this->offset_4->offset_4_vecPtr.back()->offset_0(this->offset_4, a2);
this->offset_4->offset_4_vecPtr.front()->offset_0(this->offset_4, a2);
}
}

View File

@ -0,0 +1,16 @@
#include "../../include/wxss.h"
#include <sstream>
namespace WXSS
{
namespace CSSTreeLib
{
void RuleChain::MarkGood(WXSS::CSSTreeLib::CSSSyntaxTree * a3)
{
// for (int i = 0; i < a3->; i++)
// {
// /* code */
// }
}
}
}

View File

@ -543,7 +543,7 @@ namespace WXSS
auto v7 = cur.offset_4;
if (v6 >= v7 && !strncmp(cur.offset_8, a1 + v6 - v7, cur.offset_4))
{
return this->TT[(0x5206B8 - 0x005222A0) / 4 + 7 * i];
return WXSS::Tokenizer::SCC[i].offset_24;
}
}

View File

@ -12380,7 +12380,7 @@ int __cdecl WXSS::Tokenizer::TryGetAnotherTypeByAnySubStr(int a1, int a2, int a3
{
v7 = *((_DWORD *)v4 + 1);
if ( v6 >= v7 && !strncmp(v4 + 8, (const char *)(a1 + v6 - v7), *((_DWORD *)v4 + 1)) )
return dword_5206B8[7 * v5];
return dword_5206B8[7 * v5]; // InitSubStrCheckingCaluseTable中初始化的
}
++v5;
v4 += 28;