diff --git a/src/include/wxss.h b/src/include/wxss.h index ef4bee1..4ee05fb 100644 --- a/src/include/wxss.h +++ b/src/include/wxss.h @@ -95,11 +95,12 @@ namespace WXSS std::string offset_0; WXSS::Token offset_24; bool offset_116; // 类型未确定 - bool offset_132; // 类型未确定 std::vector> offset_120; + bool offset_132; // 类型未确定,不是布尔值 std::shared_ptr offset_140; std::string offset_148; - std::string offset_164; // 类型? + int offset_164; + int offset_168; int offset_172; // 类型未确定 CSSSyntaxTree(/* args */); ~CSSSyntaxTree(); @@ -107,14 +108,14 @@ namespace WXSS void Print2Stream(int, std::stringstream &); void RenderCode(std::string &,bool); }; - - using Offset0Type = int(); class Rule { private: /* data */ public: - Offset0Type *offset_0 = nullptr; + + using Offset0Type1 = int(std::shared_ptr&, std::shared_ptr &); + Offset0Type1 *offset_0 = nullptr; std::vector> offset_4_vecPtr; std::vector>> offset_4_vecPair; std::vector offset_4_vecStr; @@ -129,6 +130,9 @@ namespace WXSS public: static LexicalChecker* instance; static std::mutex m; + /** + * 初始化标志 + */ bool offset_0 = false; std::shared_ptr offset_4; // 8字节 LexicalChecker(/* args */); @@ -138,6 +142,7 @@ namespace WXSS static LexicalChecker* GetInstance(bool); }; + using Offset0Type = int(); class Base { private: diff --git a/src/wxss/css_tree_lib/css_syntax_tree.cpp b/src/wxss/css_tree_lib/css_syntax_tree.cpp index 40a42fc..e772850 100644 --- a/src/wxss/css_tree_lib/css_syntax_tree.cpp +++ b/src/wxss/css_tree_lib/css_syntax_tree.cpp @@ -20,10 +20,34 @@ namespace WXSS { if (!this->offset_172) { - + if (this->offset_132 && a3) + { + a2 += this->offset_132; + } + else + { + a2 += this->offset_24.GetLiteral(); + } + for (int i = 0; i < this->offset_120.size(); i++) + { + auto cur = this->offset_120[i]; + if ( + i + && cur->offset_164 > this->offset_120[i - 1]->offset_168 + && a2[a2.length() - 1] != '\n' + ) + { + a2 += " "; + } + cur->RenderCode(a2, a3); + } + if (this->offset_0 == "MEDIA_RULE" || this->offset_0 == "RULE" || this->offset_0 == "DIRECTIVE") + { + a2 += "\n"; + } + } } - throw "not implement"; } /** diff --git a/src/wxss/css_tree_lib/lexical_checker.cpp b/src/wxss/css_tree_lib/lexical_checker.cpp index c916f70..5764151 100644 --- a/src/wxss/css_tree_lib/lexical_checker.cpp +++ b/src/wxss/css_tree_lib/lexical_checker.cpp @@ -146,9 +146,8 @@ namespace WXSS { if (this->offset_0) { - + this->offset_4->offset_4_vecPtr.back()->offset_0(this->offset_4, a2); } - throw "not implement"; } } diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index 50fd98e..1087b02 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -44808,7 +44808,7 @@ void __thiscall WXSS::CSSTreeLib::CSSSyntaxTree::RenderCode(int this, WXSS::Toke v6 = 8 * v4; if ( v4 && *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4) + 164) > *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4 - 8) + 168) - && *(_BYTE *)(*(_DWORD *)a2 + *((_DWORD *)a2 + 1) - 1) != 10 ) + && *(_BYTE *)(*(_DWORD *)a2 + *((_DWORD *)a2 + 1) - 1) != '\n'/*10*/ ) { std::string::operator+=(a2, " "); v6 = 8 * v4;