diff --git a/src/include/wxss.h b/src/include/wxss.h index dba0fb1..7ddb6ea 100644 --- a/src/include/wxss.h +++ b/src/include/wxss.h @@ -93,9 +93,13 @@ namespace WXSS public: std::string offset_0; WXSS::Token offset_24; + bool offset_116; // 类型未确定 + bool offset_132; // 类型未确定 std::vector> offset_120; std::shared_ptr offset_140; + std::string offset_148; std::string offset_164; // 类型? + int offset_172; // 类型未确定 CSSSyntaxTree(/* args */); ~CSSSyntaxTree(); void GetHostRule(std::string &); diff --git a/src/wxss/css_tree_lib/css_syntax_tree.cpp b/src/wxss/css_tree_lib/css_syntax_tree.cpp index a7f6049..40a42fc 100644 --- a/src/wxss/css_tree_lib/css_syntax_tree.cpp +++ b/src/wxss/css_tree_lib/css_syntax_tree.cpp @@ -1,4 +1,6 @@ #include "../../include/wxss.h" +#include "../../include/wxml.h" +#include namespace WXSS { @@ -11,6 +13,107 @@ namespace WXSS CSSSyntaxTree::~CSSSyntaxTree() { } + + void CSSSyntaxTree::RenderCode(std::string & a2, bool a3) + { + if (this->offset_116) + { + if (!this->offset_172) + { + + } + } + throw "not implement"; + } + + /** + * offset_116等需要修正 + */ + void CSSSyntaxTree::Print2Stream(int a2, std::stringstream & a3) + { + std::string v14; + for (int i = 0; i < a2; i++) + { + if (this->offset_116) + { + v14 = " "; + } + else + { + v14 = "- "; + } + a3 << v14; + } + if (this->offset_132) + { + a3 << this->offset_0 << ": " << this->offset_132; + } + else + { + a3 << this->offset_0 << ": "; + a3 << this->offset_24.GetLiteral(); + } + a3 << std::endl; + for (int i = 0; i < this->offset_120.size(); i++) + { + this->offset_120[i]->Print2Stream(a2 + 1, a3); + } + + } + + void CSSSyntaxTree::GetHostRule(std::string & a2) + { + if (this->offset_172 == 1) + { + for (int i = 0; i < this->offset_120.size(); i++) + { + auto cur = this->offset_120[i]; + if (cur->offset_0 == "SELECTORS") + { + std::string v14 = this->offset_148.substr(2, this->offset_148.length() - 7); + std::string v15 = WXML::Rewrite::ToStringCode2(v14); + v15.insert(0, "[is=\""); + v15.append("\"]"); + a2 += v15; + } + else + { + cur->RenderCode(a2, true); + } + } + a2 += "\n"; + return; + } + if (this->offset_172 == 2) + { + for (int i = 0; i < this->offset_120.size(); i++) + { + auto cur = this->offset_120[i]; + if (cur->offset_0 != "SELECTORS") + { + cur->RenderCode(a2, true); + } + else + { + cur->RenderCode(a2, true); + std::string v14 = this->offset_148.substr(2, this->offset_148.length() - 7); + auto v15 = WXML::Rewrite::ToStringCode2(v14); + v15.insert(0, "[is=\""); + v15.append("\"]"); + a2 += v15; + } + } + a2 += "\n"; + return; + + } + for (int i = 0; i < this->offset_120.size(); i++) + { + auto cur = this->offset_120[i]; + cur->GetHostRule(a2); + } + + } } } // namespace WXSS \ No newline at end of file diff --git a/src/wxss/x_compiler.cpp b/src/wxss/x_compiler.cpp index 0d388a4..dbad026 100644 --- a/src/wxss/x_compiler.cpp +++ b/src/wxss/x_compiler.cpp @@ -602,7 +602,7 @@ namespace WXSS "}\n" "return rewritor;\n" "}\n", - v33); + v33.data()); std::string v32 = buf + v29; a3 = v32.append(v26); return 0; diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index 967ecbe..aec4ab1 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -44863,7 +44863,7 @@ void __thiscall WXSS::CSSTreeLib::CSSSyntaxTree::GetHostRule(int this, WXSS::Tok } ++v12; } -LABEL_9: + LABEL_9: std::string::operator+=(a2, "\n"); return; }