diff --git a/src/include/wxss.h b/src/include/wxss.h index 5369493..b810bab 100644 --- a/src/include/wxss.h +++ b/src/include/wxss.h @@ -158,8 +158,6 @@ namespace WXSS std::vector offset_4_vecStr; // ~Rule(); }; - - class LexicalChecker { private: @@ -179,8 +177,6 @@ namespace WXSS static LexicalChecker* GetInstance(bool); }; - - class Parser { private: diff --git a/src/wxss/css_tree_lib/lexical_checker.cpp b/src/wxss/css_tree_lib/lexical_checker.cpp index 5764151..9512992 100644 --- a/src/wxss/css_tree_lib/lexical_checker.cpp +++ b/src/wxss/css_tree_lib/lexical_checker.cpp @@ -4,6 +4,72 @@ namespace WXSS { namespace CSSTreeLib { + int off_519BB4(std::shared_ptr& a1, std::shared_ptr &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& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519B9C(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519AA0(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519A58(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + + /** + * WXSS::CSSTreeLib::ChildRule::MarkGood + */ + int off_519B84(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519B40(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519BCC(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519A88(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519AB8(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519A70(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519AE8(std::shared_ptr& a1, std::shared_ptr &a2) + { + throw "not implement"; + } + int off_519AD0(std::shared_ptr& a1, std::shared_ptr &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 v3(new WXSS::CSSTreeLib::Rule()); + v3->offset_0 = off_519B6C; + std::shared_ptr v4(new WXSS::CSSTreeLib::Rule()); + v4->offset_0 = off_519B9C; + std::shared_ptr 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 v57(new WXSS::CSSTreeLib::Rule()); - + v57->offset_0 = off_519B84; v44->push_back(v57); v44->push_back(v3); std::shared_ptr v59(new WXSS::CSSTreeLib::Rule()); @@ -42,27 +118,28 @@ namespace WXSS v61->offset_4_vecPtr.push_back(v59); if (a3) { std::shared_ptr v92(new WXSS::CSSTreeLib::Rule()); - // off_519AA0 + v92->offset_0 = off_519AA0; v61->offset_4_vecPtr.push_back(v92); } std::shared_ptr 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 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 v67(new WXSS::CSSTreeLib::Rule()); - // off_519BB4 + v67->offset_0 = off_519BB4; std::shared_ptr v69(new WXSS::CSSTreeLib::Rule()); - // off_519B84 + v69->offset_0 = off_519B84; std::shared_ptr 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 v77(new WXSS::CSSTreeLib::Rule()); - // off_519B84 + v77->offset_0 = off_519B84; v69->offset_4_vecPair.emplace_back("SELECTOR", v77); std::shared_ptr 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 v81(new WXSS::CSSTreeLib::Rule()); - // off_519B40 + v81->offset_0 = off_519B40; v69->offset_4_vecPair.emplace_back("F_SELECTOR", v81); std::shared_ptr v83(new WXSS::CSSTreeLib::Rule()); - // off_519B84 + v83->offset_0 = off_519B84; std::shared_ptr 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 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 v73(new WXSS::CSSTreeLib::Rule()); - // off_519BB4 + + v73->offset_0 = off_519BB4; v59->offset_4_vecPair.emplace_back("ATTRS", v73); std::shared_ptr 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 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 v25(new WXSS::CSSTreeLib::Rule()); - // off_519B40 + v25->offset_0 = off_519B40; std::shared_ptr v26(new WXSS::CSSTreeLib::Rule()); - // off_519B84 + v26->offset_0 = off_519B84; std::shared_ptr 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 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 v29(new WXSS::CSSTreeLib::Rule()); - // off_519B84 + v29->offset_0 = off_519B84; std::shared_ptr 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); } } diff --git a/src/wxss/css_tree_lib/rule_chain.cpp b/src/wxss/css_tree_lib/rule_chain.cpp new file mode 100644 index 0000000..91f2097 --- /dev/null +++ b/src/wxss/css_tree_lib/rule_chain.cpp @@ -0,0 +1,16 @@ +#include "../../include/wxss.h" +#include +namespace WXSS +{ + namespace CSSTreeLib + { + void RuleChain::MarkGood(WXSS::CSSTreeLib::CSSSyntaxTree * a3) + { + // for (int i = 0; i < a3->; i++) + // { + // /* code */ + // } + + } + } +} \ No newline at end of file diff --git a/src/wxss/tokenizer.cpp b/src/wxss/tokenizer.cpp index 51c7e75..bac26b6 100644 --- a/src/wxss/tokenizer.cpp +++ b/src/wxss/tokenizer.cpp @@ -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; } } diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index bc0c956..5aad041 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -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;