mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: XCompiler 一些方法
This commit is contained in:
parent
d2606d1a97
commit
1ea4517c86
@ -156,7 +156,8 @@ namespace WXSS
|
|||||||
std::string offset_8;
|
std::string offset_8;
|
||||||
std::map<std::string, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>> offset_32;
|
std::map<std::string, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>> offset_32;
|
||||||
std::map<std::string, std::vector<std::string>> offset_56;
|
std::map<std::string, std::vector<std::string>> offset_56;
|
||||||
std::map<std::string, int> offset_136;
|
std::map<std::string, int> offset_128;
|
||||||
|
std::map<std::string, std::string> offset_152;
|
||||||
XCompiler(/* args */);
|
XCompiler(/* args */);
|
||||||
XCompiler(std::map<std::string, std::string> const&, bool, std::string const&);
|
XCompiler(std::map<std::string, std::string> const&, bool, std::string const&);
|
||||||
~XCompiler();
|
~XCompiler();
|
||||||
|
@ -318,11 +318,103 @@ namespace WXSS
|
|||||||
}
|
}
|
||||||
void XCompiler::GenExpr(std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> a2, std::stringstream & a3, std::string & a4)
|
void XCompiler::GenExpr(std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> a2, std::stringstream & a3, std::string & a4)
|
||||||
{
|
{
|
||||||
throw "not implement";
|
auto target = a2->offset_120;
|
||||||
}
|
for (int i = 0; i < target.size(); i++)
|
||||||
int XCompiler::GetPageCss(std::string const&, std::string&, uint)
|
|
||||||
{
|
{
|
||||||
|
auto cur = target[i];
|
||||||
|
if (cur->offset_0 == "DIRECTIVE"
|
||||||
|
&& cur->offset_120.size() > 1
|
||||||
|
&& cur->offset_120[0]->offset_0 == "@import"
|
||||||
|
&& cur->offset_140.get()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::string v16= *cur->offset_140;
|
||||||
|
if (this->offset_128[v16] > 1)
|
||||||
|
{
|
||||||
|
this->DealRPX(a4, a3);
|
||||||
|
a3 << "[2,\"";
|
||||||
|
auto v8 = this->offset_152[v16];
|
||||||
|
a3 << WXML::Rewrite::ToStringCode2(v8);
|
||||||
|
a3 <<"\"],";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto v17 = this->offset_32[v16];
|
||||||
|
this->GenExpr(v17, a3, a4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cur->RenderCode(a4, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
int XCompiler::GetPageCss(std::string const& a2, std::string& a3, uint a4)
|
||||||
|
{
|
||||||
|
if (this->offset_0)
|
||||||
|
{
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
if (this->offset_32.find(a2) == this->offset_32.end())
|
||||||
|
{
|
||||||
|
std::stringstream v38;
|
||||||
|
v38 << "setCssToHead([],undefined,{path:\"";
|
||||||
|
v38 << WXML::Rewrite::ToStringCode2(a2);
|
||||||
|
v38 << "\"})";
|
||||||
|
a3 = v38.str();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string v30;
|
||||||
|
auto v23 = this->offset_32;
|
||||||
|
std::stringstream v38;
|
||||||
throw "not implement";
|
throw "not implement";
|
||||||
|
// if (
|
||||||
|
// this->offset_32[a2]->offset_156
|
||||||
|
// && this->offset_32[a2]->offset_156->offset_12!= -1
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// auto v6 = this->offset_32[a2];
|
||||||
|
// }
|
||||||
|
v38.clear();
|
||||||
|
v38 << "setCssToHead([";
|
||||||
|
if (this->offset_128[a2] <= 1)
|
||||||
|
{
|
||||||
|
std::string v35;
|
||||||
|
auto v33 = v23[a2];
|
||||||
|
this->GenExpr(v33, v38, v35);
|
||||||
|
if (v35.length())
|
||||||
|
{
|
||||||
|
this->DealRPX(v35, v38);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v38 << "[2,\"";
|
||||||
|
std::string v12 = this->offset_152[a2];
|
||||||
|
v38 << WXML::Rewrite::ToStringCode2(v12);
|
||||||
|
v38 << "\"]";
|
||||||
|
}
|
||||||
|
v38 << "]";
|
||||||
|
if (v30.length())
|
||||||
|
{
|
||||||
|
v38 << ",\"" << v30 << "\"";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v38 << ",undefined";
|
||||||
|
}
|
||||||
|
v38 << ",{path:\"";
|
||||||
|
v38 << WXML::Rewrite::ToStringCode2(a2);
|
||||||
|
v38 << "\"})";
|
||||||
|
a3 = v38.str();
|
||||||
|
|
||||||
|
}
|
||||||
|
return this->offset_0;
|
||||||
}
|
}
|
||||||
void XCompiler::MarkImported(std::string const&)
|
void XCompiler::MarkImported(std::string const&)
|
||||||
{
|
{
|
||||||
|
@ -8189,8 +8189,8 @@ int __thiscall WXSS::XCompiler::GenExpr(int this, int a2, int a3, WXSS::Token *a
|
|||||||
if ( (unsigned int)lpuexcpt >= (*(_DWORD *)(*(_DWORD *)a2 + 124) - v4) >> 3 )
|
if ( (unsigned int)lpuexcpt >= (*(_DWORD *)(*(_DWORD *)a2 + 124) - v4) >> 3 )
|
||||||
break;
|
break;
|
||||||
if ( std::operator==<char>(*(_DWORD *)(v4 + 8 * (_DWORD)lpuexcpt), "DIRECTIVE")
|
if ( std::operator==<char>(*(_DWORD *)(v4 + 8 * (_DWORD)lpuexcpt), "DIRECTIVE")
|
||||||
&& (v5 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)a2 + 120) + 8 * (_DWORD)lpuexcpt),
|
&& (v5 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)a2 + 120) + 8 * (_DWORD)lpuexcpt), // cur
|
||||||
v6 = *(int **)(v5 + 120),
|
v6 = *(int **)(v5 + 120), // cur->offset_120
|
||||||
(unsigned int)(*(_DWORD *)(v5 + 124) - (_DWORD)v6) > 8)
|
(unsigned int)(*(_DWORD *)(v5 + 124) - (_DWORD)v6) > 8)
|
||||||
&& std::operator==<char>(*v6, "@import")
|
&& std::operator==<char>(*v6, "@import")
|
||||||
&& *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(*(_DWORD *)a2 + 120) + 8 * (_DWORD)lpuexcpt) + 140) )
|
&& *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(*(_DWORD *)a2 + 120) + 8 * (_DWORD)lpuexcpt) + 140) )
|
||||||
@ -8296,9 +8296,10 @@ int __thiscall WXSS::XCompiler::GetPageCss(char *this, int *a2, _DWORD *a3, int
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
v30 = (int)&v32; // std::string
|
||||||
v31 = 0;
|
v31 = 0;
|
||||||
v30 = (int)&v32;
|
|
||||||
v32 = 0;
|
v32 = 0;
|
||||||
|
|
||||||
if ( *(_DWORD *)(*(_DWORD *)std::map<std::string,zcc::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>>::operator[](
|
if ( *(_DWORD *)(*(_DWORD *)std::map<std::string,zcc::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>>::operator[](
|
||||||
v23,
|
v23,
|
||||||
(int)a2)
|
(int)a2)
|
||||||
@ -8355,7 +8356,7 @@ int __thiscall WXSS::XCompiler::GetPageCss(char *this, int *a2, _DWORD *a3, int
|
|||||||
WXML::Rewrite::ToStringCode2((int)&v35, v12);
|
WXML::Rewrite::ToStringCode2((int)&v35, v12);
|
||||||
v13 = std::operator<<<char>(v24, &v35);
|
v13 = std::operator<<<char>(v24, &v35);
|
||||||
v14 = std::operator<<<std::char_traits<char>>(v13, "\"");
|
v14 = std::operator<<<std::char_traits<char>>(v13, "\"");
|
||||||
std::operator<<<std::char_traits<char>>(v14, (char *)&off_50EEF5[2]);
|
std::operator<<<std::char_traits<char>>(v14, (char *)&off_50EEF5[2]); // ']'
|
||||||
}
|
}
|
||||||
std::string::_M_dispose((void **)&v35);
|
std::string::_M_dispose((void **)&v35);
|
||||||
std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v39, (char *)&off_50EEF5[2]);
|
std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v39, (char *)&off_50EEF5[2]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user