diff --git a/src/wxml/common.cpp b/src/wxml/common.cpp index de5ce60..71bfb61 100644 --- a/src/wxml/common.cpp +++ b/src/wxml/common.cpp @@ -121,9 +121,11 @@ namespace WXML { { std::vector> v10; WXML::StrSplitList4ClassSuffix(cur.second.data(), "%%HERESUFFIX%%", v10); + std::string str = a2.str(); for (int j=0; j < v10.size(); j++) { - WXML::RenderStrToken(v10[i], a2); + WXML::RenderStrToken(v10[j], a2); + str = a2.str(); } } else if (!cur.first) diff --git a/src/wxss/css_tree_lib/lexical_checker.cpp b/src/wxss/css_tree_lib/lexical_checker.cpp index 9e999a8..7b62a05 100644 --- a/src/wxss/css_tree_lib/lexical_checker.cpp +++ b/src/wxss/css_tree_lib/lexical_checker.cpp @@ -239,13 +239,18 @@ namespace WXSS return 0; } + int MarkSelectorRule_i = 0; // WXSS::CSSTreeLib::MarkSelectorRule::MarkGood int off_519AD0(std::shared_ptr& a1, std::shared_ptr &a2) { + MarkSelectorRule_i++; + int inner_MarkSelectorRule_i = MarkSelectorRule_i; // TODO: 校对至80 + // MarkSelectorRule - 0 for (int i = 0; i < a2->offset_120.size(); i++) { auto cur = a2->offset_120[i]; std::string v14 = cur->offset_0; + // MarkSelectorRule - 5 if (i) { if (cur->offset_164 <= a2->offset_120[i - 1]->offset_168) @@ -259,10 +264,11 @@ namespace WXSS auto v6 = cur; auto v10 = v6->offset_120[0]; *v5 = v10->offset_24; - std::shared_ptr str(new std::string()); - *str = a2->offset_148[0]; - a2->offset_156->offset_4 = str; - return 1; + // std::shared_ptr str(new std::string()); + // *str = a2->offset_148[0]; + // a2->offset_156->offset_4 = str; + // return 1; + break; } else { @@ -332,6 +338,7 @@ namespace WXSS break; } } + // MarkSelectorRule - 10 if (v14[0] != 'F' || strcmp(v14.data() + 1, "_SELECTOR")) { if (v14[0] == 'F') @@ -343,18 +350,83 @@ namespace WXSS auto v6 = cur; auto v10 = v6->offset_120[0]; *v5 = v10->offset_24; - std::shared_ptr str(new std::string()); - *str = a2->offset_148[0]; - a2->offset_156->offset_4 = str; - return 1; + // std::shared_ptr str(new std::string()); + // *str = a2->offset_148[0]; + // a2->offset_156->offset_4 = str; + // return 1; + break; } else { continue; } } + else if (v14[0] == 'S' && !strcmp(v14.data() + 1, "ELECTOR")) + { + auto v13 = cur->offset_120; + if (v13.size() == 0) + { + continue; + } + for (auto i = v13.begin(); i != v13.end(); i++) + { + if ((*i)->offset_0[0] == '$') + { + if (!strcmp((*i)->offset_0.data() + 1, "NAME")) + { + std::string lit = (*i)->offset_24.GetLiteral(); + if (lit[0] == '.' || lit[0] == '@') + { + continue; + } + if (lit[0] == 'f') + { + if (!strcmp(lit.data() + 1, "orm")) + { + continue; + } + } + else if (lit[0] == 't') + { + if (!strcmp(lit.data() + 1, "o")) + { + continue; + } + + } + if (lit[lit.length() - 1] != '%') + { + // LABEL_32 + auto v5 = a2->offset_156; + auto v10 = *i; + *v5 = v10->offset_24; + std::shared_ptr str(new std::string()); + *str = a2->offset_148[0]; + a2->offset_156->offset_4 = str; + return 1; + } + continue; + } + if (!strcmp((*i)->offset_0.data() + 1,"ID")) + { + auto v5 = a2->offset_156; + auto v10 = *i; + *v5 = v10->offset_24; + std::shared_ptr str(new std::string()); + *str = a2->offset_148[0]; + a2->offset_156->offset_4 = str; + return 1; + } + } + } + continue; + } + auto v5 = a2->offset_156; + auto v10 = cur->offset_120[0]; + *v5 = v10->offset_24; break; } + // MarkSelectorRule - 15 if (cur->offset_120.size() <= 1) { // goto LABEL_14; @@ -362,11 +434,13 @@ namespace WXSS auto v6 = cur; auto v10 = v6->offset_120[0]; *v5 = v10->offset_24; - std::shared_ptr str(new std::string()); - *str = a2->offset_148[0]; - a2->offset_156->offset_4 = str; - return 1; + // std::shared_ptr str(new std::string()); + // *str = a2->offset_148[0]; + // a2->offset_156->offset_4 = str; + // return 1; + break; } + // MarkSelectorRule - 20 auto v3 = cur->offset_120[0]; std::string lit = v3->offset_24.GetLiteral(); if (v3->offset_0[0] != '$' @@ -379,12 +453,17 @@ namespace WXSS auto v6 = cur; auto v10 = v6->offset_120[0]; *v5 = v10->offset_24; - std::shared_ptr str(new std::string()); - *str = a2->offset_148[0]; - a2->offset_156->offset_4 = str; - return 1; + // std::shared_ptr str(new std::string()); + // *str = a2->offset_148[0]; + // a2->offset_156->offset_4 = str; + // return 1; + break; } } + std::shared_ptr str(new std::string()); + *str = a2->offset_148[0]; + a2->offset_156->offset_4 = str; + return 1; } diff --git a/src/wxss/x_compiler.cpp b/src/wxss/x_compiler.cpp index c14775c..6ed1476 100644 --- a/src/wxss/x_compiler.cpp +++ b/src/wxss/x_compiler.cpp @@ -179,7 +179,7 @@ namespace WXSS void XCompiler::GetHostRule(std::string & a2) { std::string v6; - for (auto i = this->offset_32.rbegin(); i != this->offset_32.rend(); i++) + for (auto i = this->offset_32.begin(); i != this->offset_32.end(); i++) { i->second->GetHostRule(v6); } @@ -349,8 +349,15 @@ namespace WXSS return ret; } + + int GenExpr_i = 0; + /** + * a4 参数正确 + */ void XCompiler::GenExpr(std::shared_ptr a2, std::stringstream & a3, std::string & a4) { + GenExpr_i++; + int inner_GenExpr_i = GenExpr_i; auto target = a2->offset_120; for (int i = 0; i < target.size(); i++) { @@ -381,11 +388,14 @@ namespace WXSS cur->RenderCode(a4, 1); } } - + std::string str = a3.str(); return ; } + int GetPageCss_i = 0; int XCompiler::GetPageCss(std::string const& a2, std::string& a3, uint a4) { + GetPageCss_i++; + int inner_GetPageCss_i = GetPageCss_i; if (this->offset_0) { return 6; diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index 94dde55..2977389 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -44997,7 +44997,7 @@ void __thiscall WXSS::CSSTreeLib::CSSSyntaxTree::GetHostRule(int this, WXSS::Tok { while ( 1 ) { - v3 = *(_DWORD *)(this + 120); + v3 = *(_DWORD *)(this + 120); // begin if ( (*(_DWORD *)(this + 124) - v3) >> 3 <= v12 ) break; if ( std::operator==(*(_DWORD *)(v3 + 8 * v12), "SELECTORS") ) @@ -45028,7 +45028,7 @@ void __thiscall WXSS::CSSTreeLib::CSSSyntaxTree::GetHostRule(int this, WXSS::Tok { while ( 1 ) { - v6 = *(_DWORD *)(this + 120); + v6 = *(_DWORD *)(this + 120); // begin if ( (*(_DWORD *)(this + 124) - v6) >> 3 <= v12 ) break; v7 = !std::operator==(*(_DWORD *)(v6 + 8 * v12), "SELECTORS"); @@ -45061,7 +45061,7 @@ void __thiscall WXSS::CSSTreeLib::CSSSyntaxTree::GetHostRule(int this, WXSS::Tok } while ( 1 ) { - v11 = *(_DWORD *)(this + 120); + v11 = *(_DWORD *)(this + 120); // begin if ( (*(_DWORD *)(this + 124) - v11) >> 3 <= v12 ) break; WXSS::CSSTreeLib::CSSSyntaxTree::GetHostRule(*(_DWORD *)(v11 + 8 * v12++), a2); @@ -46032,6 +46032,7 @@ char __stdcall WXSS::CSSTreeLib::MarkSelectorRule::MarkGood( char *v23; // [esp+68h] [ebp-10h] BYREF volatile signed __int32 *v24[3]; // [esp+6Ch] [ebp-Ch] BYREF + // MarkSelectorRule - 0 for ( lpuexcpt = 0; ; lpuexcpt = (struct _Unwind_Exception *)((char *)lpuexcpt + 1) ) { v2 = *((_DWORD *)this + 30); @@ -46039,16 +46040,20 @@ char __stdcall WXSS::CSSTreeLib::MarkSelectorRule::MarkGood( goto LABEL_39; Str = *(char **)(v2 + 8 * (_DWORD)lpuexcpt); // cur v14 = *(_DWORD *)Str; // cur + // MarkSelectorRule - 5 if ( lpuexcpt ) { if ( *((_DWORD *)Str + 41) <= *(_DWORD *)(*(_DWORD *)(v2 + 8 * (_DWORD)lpuexcpt - 8) + 168) ) break; } + // MarkSelectorRule - 10 if ( *(_BYTE *)v14 != 'F'/*70*/ || strcmp((const char *)(v14 + 1), "_SELECTOR") ) break; v3 = *((_DWORD *)Str + 30); // cur->offset_120 + // MarkSelectorRule - 15 if ( (unsigned int)(*((_DWORD *)Str + 31) - v3) <= 8 ) // size goto LABEL_14; + // MarkSelectorRule - 20 std::__shared_ptr::__shared_ptr( &v23, (_DWORD *)(v3 + 8)); @@ -46074,7 +46079,7 @@ LABEL_38: goto LABEL_35; goto LABEL_38; // continue; } - v13 = (_DWORD **)*((_DWORD *)Str + 30); + v13 = (_DWORD **)*((_DWORD *)Str + 30); // cur->offset_120 if ( *(_BYTE *)v14 == 'S'/*83*/ && !strcmp((const char *)(v14 + 1), "ELECTOR") ) { v12 = (_DWORD **)*((_DWORD *)Str + 31);