mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: CSSSyntaxTree一些方法
This commit is contained in:
parent
d53812d2ae
commit
bbaeb819e1
@ -93,9 +93,13 @@ namespace WXSS
|
||||
public:
|
||||
std::string offset_0;
|
||||
WXSS::Token offset_24;
|
||||
bool offset_116; // 类型未确定
|
||||
bool offset_132; // 类型未确定
|
||||
std::vector<std::shared_ptr<CSSSyntaxTree>> offset_120;
|
||||
std::shared_ptr<std::string> offset_140;
|
||||
std::string offset_148;
|
||||
std::string offset_164; // 类型?
|
||||
int offset_172; // 类型未确定
|
||||
CSSSyntaxTree(/* args */);
|
||||
~CSSSyntaxTree();
|
||||
void GetHostRule(std::string &);
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "../../include/wxss.h"
|
||||
#include "../../include/wxml.h"
|
||||
#include <sstream>
|
||||
|
||||
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
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user