fix: 逻辑错误

This commit is contained in:
msojocs 2023-08-26 13:53:24 +08:00
parent 8ccd5799a8
commit 72b00f5dff
4 changed files with 119 additions and 23 deletions

View File

@ -121,9 +121,11 @@ namespace WXML {
{
std::vector<std::pair<WXML::STRTOKEN,std::string>> 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)

View File

@ -239,13 +239,18 @@ namespace WXSS
return 0;
}
int MarkSelectorRule_i = 0;
// WXSS::CSSTreeLib::MarkSelectorRule::MarkGood
int off_519AD0(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &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<std::string> str(new std::string());
*str = a2->offset_148[0];
a2->offset_156->offset_4 = str;
return 1;
// std::shared_ptr<std::string> 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<std::string> str(new std::string());
*str = a2->offset_148[0];
a2->offset_156->offset_4 = str;
return 1;
// std::shared_ptr<std::string> 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<std::string> 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<std::string> 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<std::string> str(new std::string());
*str = a2->offset_148[0];
a2->offset_156->offset_4 = str;
return 1;
// std::shared_ptr<std::string> 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<std::string> str(new std::string());
*str = a2->offset_148[0];
a2->offset_156->offset_4 = str;
return 1;
// std::shared_ptr<std::string> str(new std::string());
// *str = a2->offset_148[0];
// a2->offset_156->offset_4 = str;
// return 1;
break;
}
}
std::shared_ptr<std::string> str(new std::string());
*str = a2->offset_148[0];
a2->offset_156->offset_4 = str;
return 1;
}

View File

@ -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<WXSS::CSSTreeLib::CSSSyntaxTree> 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;

View File

@ -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==<char>(*(_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==<char>(*(_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<WXSS::CSSTreeLib::CSSSyntaxTree,(__gnu_cxx::_Lock_policy)2>::__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);