mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: RenderCode
This commit is contained in:
parent
9ee603335a
commit
1e0236bfcc
@ -95,11 +95,12 @@ namespace WXSS
|
|||||||
std::string offset_0;
|
std::string offset_0;
|
||||||
WXSS::Token offset_24;
|
WXSS::Token offset_24;
|
||||||
bool offset_116; // 类型未确定
|
bool offset_116; // 类型未确定
|
||||||
bool offset_132; // 类型未确定
|
|
||||||
std::vector<std::shared_ptr<CSSSyntaxTree>> offset_120;
|
std::vector<std::shared_ptr<CSSSyntaxTree>> offset_120;
|
||||||
|
bool offset_132; // 类型未确定,不是布尔值
|
||||||
std::shared_ptr<std::string> offset_140;
|
std::shared_ptr<std::string> offset_140;
|
||||||
std::string offset_148;
|
std::string offset_148;
|
||||||
std::string offset_164; // 类型?
|
int offset_164;
|
||||||
|
int offset_168;
|
||||||
int offset_172; // 类型未确定
|
int offset_172; // 类型未确定
|
||||||
CSSSyntaxTree(/* args */);
|
CSSSyntaxTree(/* args */);
|
||||||
~CSSSyntaxTree();
|
~CSSSyntaxTree();
|
||||||
@ -107,14 +108,14 @@ namespace WXSS
|
|||||||
void Print2Stream(int, std::stringstream &);
|
void Print2Stream(int, std::stringstream &);
|
||||||
void RenderCode(std::string &,bool);
|
void RenderCode(std::string &,bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
using Offset0Type = int();
|
|
||||||
class Rule
|
class Rule
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
public:
|
public:
|
||||||
Offset0Type *offset_0 = nullptr;
|
|
||||||
|
using Offset0Type1 = int(std::shared_ptr<WXSS::CSSTreeLib::Rule>&, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &);
|
||||||
|
Offset0Type1 *offset_0 = nullptr;
|
||||||
std::vector<std::shared_ptr<WXSS::CSSTreeLib::Rule>> offset_4_vecPtr;
|
std::vector<std::shared_ptr<WXSS::CSSTreeLib::Rule>> offset_4_vecPtr;
|
||||||
std::vector<std::pair<std::string, std::shared_ptr<WXSS::CSSTreeLib::Rule>>> offset_4_vecPair;
|
std::vector<std::pair<std::string, std::shared_ptr<WXSS::CSSTreeLib::Rule>>> offset_4_vecPair;
|
||||||
std::vector<std::string> offset_4_vecStr;
|
std::vector<std::string> offset_4_vecStr;
|
||||||
@ -129,6 +130,9 @@ namespace WXSS
|
|||||||
public:
|
public:
|
||||||
static LexicalChecker* instance;
|
static LexicalChecker* instance;
|
||||||
static std::mutex m;
|
static std::mutex m;
|
||||||
|
/**
|
||||||
|
* 初始化标志
|
||||||
|
*/
|
||||||
bool offset_0 = false;
|
bool offset_0 = false;
|
||||||
std::shared_ptr<WXSS::CSSTreeLib::Rule> offset_4; // 8字节
|
std::shared_ptr<WXSS::CSSTreeLib::Rule> offset_4; // 8字节
|
||||||
LexicalChecker(/* args */);
|
LexicalChecker(/* args */);
|
||||||
@ -138,6 +142,7 @@ namespace WXSS
|
|||||||
static LexicalChecker* GetInstance(bool);
|
static LexicalChecker* GetInstance(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using Offset0Type = int();
|
||||||
class Base
|
class Base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -20,10 +20,34 @@ namespace WXSS
|
|||||||
{
|
{
|
||||||
if (!this->offset_172)
|
if (!this->offset_172)
|
||||||
{
|
{
|
||||||
|
if (this->offset_132 && a3)
|
||||||
|
{
|
||||||
|
a2 += this->offset_132;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
a2 += this->offset_24.GetLiteral();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < this->offset_120.size(); i++)
|
||||||
|
{
|
||||||
|
auto cur = this->offset_120[i];
|
||||||
|
if (
|
||||||
|
i
|
||||||
|
&& cur->offset_164 > this->offset_120[i - 1]->offset_168
|
||||||
|
&& a2[a2.length() - 1] != '\n'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
a2 += " ";
|
||||||
|
}
|
||||||
|
cur->RenderCode(a2, a3);
|
||||||
|
}
|
||||||
|
if (this->offset_0 == "MEDIA_RULE" || this->offset_0 == "RULE" || this->offset_0 == "DIRECTIVE")
|
||||||
|
{
|
||||||
|
a2 += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw "not implement";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,9 +146,8 @@ namespace WXSS
|
|||||||
{
|
{
|
||||||
if (this->offset_0)
|
if (this->offset_0)
|
||||||
{
|
{
|
||||||
|
this->offset_4->offset_4_vecPtr.back()->offset_0(this->offset_4, a2);
|
||||||
}
|
}
|
||||||
throw "not implement";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44808,7 +44808,7 @@ void __thiscall WXSS::CSSTreeLib::CSSSyntaxTree::RenderCode(int this, WXSS::Toke
|
|||||||
v6 = 8 * v4;
|
v6 = 8 * v4;
|
||||||
if ( v4
|
if ( v4
|
||||||
&& *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4) + 164) > *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4 - 8) + 168)
|
&& *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4) + 164) > *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4 - 8) + 168)
|
||||||
&& *(_BYTE *)(*(_DWORD *)a2 + *((_DWORD *)a2 + 1) - 1) != 10 )
|
&& *(_BYTE *)(*(_DWORD *)a2 + *((_DWORD *)a2 + 1) - 1) != '\n'/*10*/ )
|
||||||
{
|
{
|
||||||
std::string::operator+=(a2, " ");
|
std::string::operator+=(a2, " ");
|
||||||
v6 = 8 * v4;
|
v6 = 8 * v4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user